使用React -router创建React App Build,导致块的位置不正确



得到下面的错误,它应该是:http://localhost:4000/webapp/static/js/328.f5f431ed.chunk.js

这只发生在生产版本中,而不是在开发运行中。

它附加在react router路由的末尾。不确定如何正确配置这个?

Uncaught (in promise) ChunkLoadError: Loading chunk 328 failed.
(missing: http://localhost:4000/webapp/editor/ae2c222b-fc4b-40b7-bfae-7a0750c011fc/static/js/328.f5f431ed.chunk.js)
at Object.__webpack_require__.f.j (jsonp chunk loading:27:18)

尝试更改配置-尝试了不同的组合,但无法使其工作

craco.config.js

const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = {
webpack: {
output: {
publicPath: '/webapp/',
},
plugins: [new MonacoWebpackPlugin({ publicPath: '/webapp/', languages: ['json', 'python', 'shell', 'python']})],
},
};

总算弄明白了

在包中。Json代替

"homepage": ".",

使用:

"homepage": "/webapp/",

最新更新