Multiple assets emit different content to the same filename

See original GitHub issue

Bug report

What is the current behavior?

webpack shows a warning when rebuild:

Multiple assets emit different content to the same filename app.js.map

If the current behavior is a bug, please provide the steps to reproduce.

webpack.config.js

const path = require('path')
const webpack = require('webpack')

module.exports = {
  mode: 'development',
  entry: {
    app: './entry.js'
  },
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: '[name].js'
  },
  devtool: false,
  plugins: [
    new webpack.SourceMapDevToolPlugin({
      filename: '[name].js.map'
    }),

    new webpack.HotModuleReplacementPlugin() // !!!!!!! remove this line, the warning will not display
  ]
}

entry.js

console.log(`
  modify this module, then webpack shows warning:
  WARNING in Conflict: Multiple assets emit different content to the same filename app.js.map
`)

reproduction steps:

  1. use SourceMapDevToolPlugin and HotModuleReplacementPlugin (refer to webpack.config.js)
  2. npx webpack --watch
  3. modify content of entry.js, then save
  4. webpack shows a warning: Multiple assets emit different content to the same filename app.js.map

webpack doesn’t show this warning if i remove the line new webpack.HotModuleReplacementPlugin()

What is the expected behavior?

webpack should not show a warning

Other relevant information: webpack version: 4.41.0 Node.js version: v10.15.3 Operating System: win10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

48reactions
alexander-akaitcommented, Nov 19, 2019

@donotlb Please use filename: '[file].map[query]' for SourceMapDevToolPlugin, you can’t use [name] because hmr emit updates for example using app.3d0af954e7d8c1e90af5.hot-update.js file and you have three assets before generating source maps:

  • 3d0af954e7d8c1e90af5.hot-update.json
  • app.js - [name] is app
  • app.3d0af954e7d8c1e90af5.hot-update.js - [name] is app

then you generate source maps using [name].js.map for second asset and third asset you get two source maps with the same name app.js.map

13reactions
Shelmy-ppcommented, May 22, 2020

Please help to solve this warnings after angular 9 and primeng 9 migration

WARNING in ./src/assets/css/style.css Module Warning (from ./node_modules/postcss-loader/src/index.js): Warning

(146:3) start value has mixed support, consider using flex-start instead

WARNING in Conflict: Multiple assets emit different content to the same filename loading.gif

WARNING in Conflict: Multiple assets emit different content to the same filename password-meter.png

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflict: Multiple assets emit to the same filename
First of all, on your output , you are specifying the filename to app.js ... Multiple assets emit different content to the same...
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 different content to the same filename
Bug 2013416 - Multiple assets emit different content to the same filename. Summary: Multiple assets emit different content to the same filename ...
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 >
Multiple assets emit different content to the same filename
webpack --mode production assets by status 241 KiB [cached] 4 assets Entrypoint feature = feature.css feature.js 4 auxiliary assets orphan ...
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