After react-router@4 is packaged, an error is reported through the access to / a _ b

in the development environment, it can be accessed normally through / info/boss, but cannot be accessed through / info/boss after packaging. An error

was reported.
main.5fc0fc94.js:1 Uncaught SyntaxError: Unexpected token 

if you can access it normally through dispatch (push ("/ a React, b"), please give us some advice when you first get in touch with it. Thank you!
the routing code configured is as follows:

<Provider store={store}>
      <PersistGate persistor={persistor}>
        <ConnectedRouter history={browserHistory}>
          <Switch>
            <Route path={"/football"} component={Football}/>
            <Route path={"/button-sliding"} component={ButtonSliding}/>
            <Route path={"/rectangular-loader"} component={RectangularLoader}/>
            <Route path={"/diagonal-border"} component={DiagonalBorderEffects}/>
            <Route path={"/mg3D-button"} component={MG3DButton}/>
            <Route path={"/ss-toggle"} component={SSToggle}/>
            <Route path={"/blue-dazzling-diamond"} component={BDDiamond}/>
            {/**/}
            <Route path={"/login"} component={Login}/>
            <Route path={"/register"} component={Index}/>
            <Route path={"/info/boss"} component={BossInfo}/>
            <Route path={"/info/genius"} component={GeniusInfo}/>
            <Route path={"/test"} component={Dashboard}/>
          </Switch>
        </ConnectedRouter>
      </PersistGate>
    </Provider>

Nginx configuration:

server {
    listen 80;
    autoindex on;
    server_name t-cxp.test.com;
    access_log E:/myinstall/nginx-1.10.2/logs/access.log combined;
    location / {
        root F:/workspace/nginx-root;
        index index.html index.htm;
        try_files $uri /index.html;
    }
}
Apr.05,2021

it should be that the js path generated by the package is a relative path. If there is an error in finding the js path in multi-layer routing, try changing the path generated by the package to an absolute path

.
Menu