prerender-loader icon indicating copy to clipboard operation
prerender-loader copied to clipboard

Child compilation failed

Open he5050 opened this issue 5 years ago • 6 comments

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

he5050 avatar Dec 10 '18 09:12 he5050

+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

chiboreache avatar Jan 26 '19 19:01 chiboreache

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 avatar Feb 03 '19 11:02 kradalby

@kradalby Nuxt.js just work ;)

chiboreache avatar Feb 03 '19 11:02 chiboreache

Scratch it, my issue was https://github.com/vuejs/vue-cli/issues/3407#issuecomment-459985313

Which was a underlying dependency, sorry about that.

kradalby avatar Feb 03 '19 11:02 kradalby

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: ""
      }
    }),

developit avatar Feb 22 '19 13:02 developit

With multiple entry points I get this error: Conflict: Multiple chunks emit assets to the same filename ssr-bundle.js (chunks other and example)

firebluetom2 avatar May 12 '20 14:05 firebluetom2