Nuxt.js: Multiple Assets Emit to the Same Filename

Created on 12 Sep 2019  路  12Comments  路  Source: nuxt/nuxt.js

Version

v2.9.2

Reproduction link

https://github.com/phillipcurl/nuxt-test

Steps to reproduce

  • Clone repo
  • npm i
  • npm run dev
  • save any page, layout, component, etc.

What is expected ?

The dev server re-builds the necessary files and hot-reloads.

What is actually happening?

The dev server crashes and emits the following error:

/Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compilation.js:1994
                throw new Error(
                ^

Error: Conflict: Multiple assets emit to the same filename 1debded57fadef5ec63a.hot-update.json
    at Compilation.emitAsset (/Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compilation.js:1994:11)
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compiler.js:333:28
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compiler.js:678:31
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compilation.js:1404:35
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compilation.js:1395:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/PC/projects/nuxt-test/node_modules/webpack/lib/Compilation.js:1390:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/PC/projects/nuxt-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)

This bug report is available on Nuxt community (#c9770)
bug-report

Most helpful comment

@phillipcurl yep, I just pulled down your repo. If you downgrade to [email protected], it works:

npm install [email protected]

All 12 comments

That's definitely the issue I'm running into, but I'm not sure what would be causing it in my scenario.

I set up a test repo that is a basic Nuxt app created using create-nuxt-app. I'm not importing any additional assets, aside from what the base template imports. I would imagine other people are running into this when using create-nuxt-app, otherwise it would be something specific to my environment.

@fitztrev Ignore that last comment of mine. When I looked at the issue you referenced, everyone was mentioning including things like component libraries. It looks like this is actually an issue with the 4.40.0 release of webpack: https://github.com/webpack/webpack/commit/758269e81456c946a96b521ee936dbec99d07132#diff-d6308b00976bdf2edefc0f08dd6e1cafR1993

@phillipcurl yep, I just pulled down your repo. If you downgrade to [email protected], it works:

npm install [email protected]

@fitztrev I did the same and it's working for me. @Atinux I imagine you'll want to explicitly tag that version for Nuxt as well until the issue is resolved?

I can confirm the same problem

Same here, but after "yarn add [email protected]", another error:

ERROR  Failed to compile with 1 errors 

This relative module was not found:

* ./components/nuxt-error.vue in ./.nuxt/index.js
i Waiting for file changes
i Memory usage: 139 MB (RSS: 203 MB)

Same happens with v2.9.2 and edge (v2.10.0-26137449.0e0149d8).

Updating Line 1993 in the webpack lib/Compilation.js file fixed this issue for me, until this gets fixed.

Found the solution here

Webpack v4.40.1 has been released and fixes this.

I am also getting the relative path issue with Webpack 4.40.1 and 4.40.2

 ERROR  Failed to compile with 2 errors                                                                                                                                                           friendly-errors 12:37:06

These relative modules were not found:                                                                                                                                                            friendly-errors 12:37:06
                                                                                                                                                                                                  friendly-errors 12:37:06
* ../node_modules/vuetify/dist/vuetify.css in ./.nuxt/App.js                                                                                                                                      friendly-errors 12:37:06
* ../layouts/error.vue in ./.nuxt/index.js  

any ideas?

@fontzter What do your imports look like for those files? I haven't run into this issue again since the 4.40.1 release of Webpack like @fitztrev mentioned. A demo repo would be helpful as well.

I'm going to close this because I think it might cause confusion for people running into a similar error, as it's likely not related to Webpack unless they're on the 4.40.0 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattdharmon picture mattdharmon  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

mikekidder picture mikekidder  路  3Comments

surmon-china picture surmon-china  路  3Comments

uptownhr picture uptownhr  路  3Comments