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.

Error: Conflict: Multiple chunks emit assets to the same filename ssr-bundle.js

See original GitHub issue

Hi, I have encountered this problem when I was trying to create multiple html files with multiple entries.

Error: Child compilation failed:
  Error: Conflict: Multiple chunks emit assets to the same filename ssr-bundle.js (chunks 1 and 2  )
//webpack config
config.entry = {
  a: './a.js',
  b: './b.js',
}

Object.keys(config.entry).map(i => {
  config.plugins.push(
    new HtmlWebpackPlugin({
      template: `!!prerender-loader?string!./template.html`,
      filename: `${i}.html`,
      hash: false,
      chunks: [i],
    }),
  );
});

I have tried below but doesnt make any difference.

template: `!!prerender-loader?${JSON.stringify({ string: true, params: { url: `/${i}/` } })}!./template.html`
        "html-webpack-plugin": "^4.0.0-alpha.2",
        "prerender-loader": "^1.2.0",
        "webpack": "^4.29.3",
        "webpack-assets-manifest": "^2.0.0",
        "webpack-cli": "^3.1.1",
        "webpack-dev-server": "^3.1.14"

node v11.9.0.

Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

3reactions
developitcommented, Feb 22, 2019

@edwardfhsiao alright, I figured out the issue with the demo you linked above: it’s a duplicate of #25, and the solution I posted there a couple hours ago works here too:

Object.keys(config.entry).map(i => {
  config.plugins.push(
    new HtmlWebpackPlugin({
-     template: `!!prerender-loader?string!${PATH.HTML_PATH}/template.html`,
+     template: `!!prerender-loader?string&entry=${config.entry[i]}!${PATH.HTML_PATH}/template.html`,
      // etc
    }),
  );
});
1reaction
edwardfxiaocommented, May 5, 2019

@northamerican <%= htmlWebpackPlugin.options.title %>just comes from

 new HtmlWebpackPlugin({
      ...
      title: `${i}`,

It is a format of HtmlWebpackPlugin, which does not really matter in this case.

As for the multiple entry issues, I guess still needs @developit 's help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflict: Multiple assets emit to the same filename
The html-webpack-plugin generates an index.html file and automatically injects the bundled js file into it. Share.
Read more >
How can I configure Webpack for better optimization? Error ...
Error : Conflict: Multiple chunks emit assets to the same filename main.js. ... Right now I have this code below in the webpack.config.js....
Read more >
JavaScript : Conflict: Multiple assets emit to the same filename
JavaScript : Conflict : Multiple assets emit to the same filename [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] JavaScript ...
Read more >
Multiple assets emit to the same filename bundle.js - Laracasts
when i try to run mocha using laravel mix it gives me this error. Conflict: Multiple assets emit to the same filename bundle.js....
Read more >
Javascript – Conflict: Multiple assets emit to the same filename
I came across a conflict when running my webpack telling me: ERROR in chunk html [entry] app.js Conflict: Multiple assets emit to the...
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