prerender-loader
prerender-loader copied to clipboard
Child compilation failed
entry: [
"webpack-hot-middleware/client?reload=true&path=/__webpack_hmr",
"@babel/polyfill",
"./src/index.js",
"./dll/vendor.dll.js"
],
new HtmlWebpackPlugin({
filename: "index.html",
favicon: "./public/favicon.png",
template: `!!prerender-loader?string!${path.resolve(__dirname, "public", "index.ejs")}`,
inject: true,
templateParameters: {
dll: "<script src='/vendor.dll.js'></script>",
manifest: ""
}
}),
Error Info
ERROR in ./public/index.ejs (./node_modules/prerender-loader/dist/prerender-loader.js?string!./public/index.ejs)
Module build failed (from ./node_modules/prerender-loader/dist/prerender-loader.js):
Error: Child compilation failed:
resolve './webpack-hot-middleware\client?reload=true&path=\__webpack_hmr' in 'E:\h-project\txz-web-admin-car-manger'
using description file: E:\h-project\txz-web-admin-car-manger\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: E:\h-project\txz-web-admin-car-manger\package.json (relative path: ./webpack-hot-middleware/client)
no extension
Field 'browser' doesn't contain a valid alias configuration
+1
ERROR in Error: Child compilation failed:
Module build failed: Error: Child compilation failed:
- prerender-loader.js:23
[prerender]/[prerender-loader]/dist/prerender-loader.js:23:31
- Compiler.js:510 applyPluginsAsync.err
[prerender]/[webpack]/lib/Compiler.js:510:14
- Tapable.js:202 next
[prerender]/[tapable]/lib/Tapable.js:202:11
...
I just added template: '!!prerender-loader?string!index.html',
into my webpack.prod.conf.js
I have a similar in my build environment, but not on my laptop. When ran in a node:10 container it fails, but not on my Mac.
@kradalby Nuxt.js just work ;)
Scratch it, my issue was https://github.com/vuejs/vue-cli/issues/3407#issuecomment-459985313
Which was a underlying dependency, sorry about that.
When using multiple webpack entries, you must tell prerender-loader which to include:
entry: [
"webpack-hot-middleware/client?reload=true&path=/__webpack_hmr",
"@babel/polyfill",
"./src/index.js", // <-- there is no way to know that this is the correct entry
"./dll/vendor.dll.js"
],
new HtmlWebpackPlugin({
filename: "index.html",
favicon: "./public/favicon.png",
- template: `!!prerender-loader?string!${path.resolve(__dirname, "public", "index.ejs")}`,
+ template: `!!prerender-loader?string&entry=./src/index.js!${path.resolve(__dirname, "public", "index.ejs")}`,
// so we specifically pass it here ^^^^^^^^^^^^^^^^^^^^^
inject: true,
templateParameters: {
dll: "<script src='/vendor.dll.js'></script>",
manifest: ""
}
}),
With multiple entry points I get this error: Conflict: Multiple chunks emit assets to the same filename ssr-bundle.js (chunks other and example)