I am trying to use Angular as frontend and Laravel as backend and I have created my Angular project with lazy loaded modules and used webpack to do so. However, when I use my webpack-dev-server the lazy loading works find and when I use my build files and serve using Laravel it throws the error like this
Uncaught SyntaxError: Unexpected token <
Error: Loading chunk 0 failed. at HTMLScriptElement.onScriptComplete (polyfills.js:104) [angular] at HTMLScriptElement.wrapFn (polyfills.js:8558) [angular] at Object.onInvokeTask (app.js:4091) [angular]
The chunk generation works fine. It generates files like 0.chunk.js
and on...
Thanks
The other build files used the path to assets , So added that same path for chunk file generation in the webpack.config.js
. I thought the path property used for all the generated file.
the code goes like this.
output: { filename: '[name].js', chunkFilename: '[id].chunk.js', publicPath: 'assets/', path: path.resolve(__dirname, 'assets/') }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.