question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Child compilation failed

See original GitHub issue
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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

4reactions
developitcommented, Feb 22, 2019

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: ""
      }
    }),
1reaction
chiboreachecommented, Jan 26, 2019

+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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack, html-webpack-plugin, Error: Child compilation failed
After implementing html-webpack-plugin I got an Error, there's whole error stack from generated index.html . Error Stack: Html Webpack Plugin:
Read more >
Child compilation failed: Cannot read property 'slice' of ...
Current behaviour i installed: npm i html-webpack-plugin@5.0.0-alpha.17 and when i ran: webpack: ERROR in Error: Child compilation ...
Read more >
Child compilation failed: Module.createRequire is not a function
Failed to compile.Module.createRequire is not a functionERROR in Module.createRequire is not a functionERROR in Error : Child compilation ...
Read more >
Html Webpack Plugin: Error: Child compilation failed
So yesterday, I was building some application in react and initially my application was just working fine but when I installed material UI ......
Read more >
Getting issue in web pack : r/reactjs - Reddit
Html Webpack Plugin: Error: Child compilation failed: Module not found: Error: Can't resolve 'C:\Users\user\reactjs\woodenstreet-rea ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found