Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Error: Multiple conflicting contents for sourcemap source. #238

Closed
Lee-Heisenbug opened this issue Oct 11, 2018 · 27 comments
Closed

Error: Multiple conflicting contents for sourcemap source. #238

Lee-Heisenbug opened this issue Oct 11, 2018 · 27 comments
Milestone

Comments

@Lee-Heisenbug
Copy link

Hi.
I was trying to use rollup to build a simple vue app. But an error occur every time I changed the style of a component.

rollup-issue

I don't know how to fix it. Here is the project file: rollup-issue.zip

Steps to reproduce the behavior

  1. Down load the project file.
  2. run "npm i".
  3. run "npm run watch".
  4. make some change to the style block of ./src/app.vue. And the error will show up.
@Lee-Heisenbug Lee-Heisenbug changed the title Multiple conflicting contents for sourcemap source. Error: Multiple conflicting contents for sourcemap source. Oct 11, 2018
@Lee-Heisenbug
Copy link
Author

It seems could be fixed by using old version(4.2.0) of rollup-plugin-vue.

@touho
Copy link

touho commented Oct 16, 2018

Thank you so much for sharing the solution! Hope this will be fixed in future releases.

@objectivehtml
Copy link

+1 Ran into this issue as well. I don't get this issue in all circumstances, but files that are nested in imports seem to cause an issue. If I get time I will try to see what could be causing this by comparing the code changes from 4.2.

I will say, it's really hard to not just rollback to older versions. I had zero issues with other builds. It's been a real struggle just to update my dev dependencies and get stuff that has been working for a year to build correctly. Hopefully i get some time to look into this if someone else can't fix this.

@BryceMehring
Copy link

Is there an update on this issue? Watching is currently not possible if source maps are enabled.

@kekeqy
Copy link

kekeqy commented Mar 7, 2019

I have the same problem.This problem occurred when I used the 'router-link' tag to open a routing address with parameters.

@lovelyMonkey
Copy link

I have the same problem when save the vue file

@r4fx
Copy link

r4fx commented Apr 1, 2019

same here with rollup 1.7.4 and rollup-plugin-vue 4.7.2 after editing vue SFC

@Lee-Heisenbug
Copy link
Author

Lee-Heisenbug commented Apr 2, 2019

@r4fx My projects are currently using rollup 0.65.0 and rollup-plugin-vue 4.2.0. Not sure if this could be a work around. Here are the devDependencies of one of my projects:

"devDependencies": {
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"dat.gui": "^0.7.3",
"node-sass": "^4.9.3",
"rollup": "^0.65.0",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-clear": "^2.0.7",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-copy-assets": "^1.0.0",
"rollup-plugin-cpy": "^1.1.0",
"rollup-plugin-ignore": "^1.0.5",
"rollup-plugin-livereload": "^0.6.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-scss": "^0.4.0",
"rollup-plugin-serve": "^0.4.2",
"rollup-plugin-svgo": "^1.0.2",
"rollup-plugin-uglify": "^5.0.2",
"rollup-plugin-vue": "4.2.0",
"vue-template-compiler": "^2.5.17"
}

passcod added a commit to passcod/rollup that referenced this issue Apr 23, 2019
See vuejs/rollup-plugin-vue#238

In this case, Rollup throws a hard error and aborts. This is highly disruptive for all that the issue when skipping would be a missing or corrupt sourcemap! Instead, let's just skip this particular iteration. It's not the prettiest workaround, but it does have the benefit of actually making us productive again. Woo!
passcod added a commit to passcod/rollup that referenced this issue May 20, 2019
See vuejs/rollup-plugin-vue#238

In this case, Rollup throws a hard error and aborts. This is highly disruptive for all that the issue when skipping would be a missing or corrupt sourcemap! Instead, let's just skip this particular iteration. It's not the prettiest workaround, but it does have the benefit of actually making us productive again. Woo!
@jackprosser
Copy link

jackprosser commented May 31, 2019

Any news on this? This has been open for a while now and it's a fairly major issue during development.

Quick fix for anyone looking to solve the issue

npm i rollup-plugin-vue@4.2.0

@arantes555
Copy link

Just ran into this as well. Seems to be some interaction with rollup-plugin-replace

@sandrina-p
Copy link

rolling back to v4.2.0 solves the problem. However, we need the latest version that solves other previous bugs. Can you tell us (or do you know) when this issue will be a priority to fix?

@cawa-93
Copy link

cawa-93 commented Aug 15, 2019

Almost a year has passed since the issue was created. Milestone is version 4.7, but the latest version is 5.0.1. Everything looks like there will never be a solution 😔

@taoeffect
Copy link

taoeffect commented Aug 16, 2019

Hi, I will donate $200 in BTC to whoever gets a perfect fix* to this problem merged into rollup/rollup-plugin-vue. Offer expires in 1 month (September 16th, 2019).

*as in: no hacks.

@darionco
Copy link

darionco commented Aug 20, 2019

Not a "fix" but a plausible solution was committed in 3f879f3

It seems it has to do with how rollup's watch works and the source maps accumulating in the plugin. To bypass the issue, set needMap to false in your options:

config.plugins.push(vue({
    needMap: false,
}));

I am using TypeScript and haven't found issues with the source maps even after adding needMap: false, so there's that, YMMV though

@znck
Copy link
Member

znck commented Nov 21, 2019

Similar to #248, tracking there.

@znck znck closed this as completed Nov 21, 2019
@akauppi
Copy link

akauppi commented Feb 3, 2020

FYI: @darionco 's fix worked for me. rollup-plugin-vue 5.1.6

@hy-inger
Copy link

@darionco 's fix worked for me too. rollup-plugin-vue 5.1.6

@athrunsun
Copy link

athrunsun commented May 15, 2020

@darionco Your solution works for me, but what does needMap: false do? I can't find it in the official documentation.

@darionco
Copy link

I dug through the code back when I posted this solution, I can't remember what it does anymore but it is safe to use and it does NOT disable source maps...

Maybe @znck remembers what it does? (he implemented it)

@znck
Copy link
Member

znck commented May 15, 2020

needMap generates source maps for script block.

@athrunsun
Copy link

@znck So by setting needMap: false, I lost all source map support for <style> and <script> blocks in .vue files?

@znck
Copy link
Member

znck commented May 16, 2020

Yep.

@AlttiRi
Copy link

AlttiRi commented Aug 15, 2020

"rollup-plugin-vue": "^5.1.9"

needMap: false will break source maps for components – the code in script block will be undebuggable (you can't set a break point).

2

But in additional it generates virtual js files, that contain only js code of component and it are debugable.

1

Without needMap: false I get the correct source map for components:

3

But in this case I can't use watcher for auto rebuilding, it will throw UnhandledPromiseRejectionWarning: Error: Multiple conflicting contents for sourcemap source.

import {watch} from "rollup";
import {inputOptions, outputOptions} from "./my-options.js";

const watchOptions = {
    ...inputOptions,
    watch: {
        skipWrite: true,
    }
};

const watcher = watch(watchOptions);
watcher.on("event", async event => {
    if (event.code === "BUNDLE_END") {
        const res = await event.result.generate(outputOptions); // Error (after I changed a watched file)
    }
});

@AlttiRi
Copy link

AlttiRi commented Aug 15, 2020

And it forces me to use the full Rollup rebuilding:

watcher.on("event", async event => {
    if (event.code === "START") {
        await build();
    }
});

What takes noticeable additional time.

@AlttiRi
Copy link

AlttiRi commented Aug 15, 2020

I think this issue should be reopen. #248 is about the related bug to this one, but it is not the same bug.

Currently it's impossible to use watcher with this plugin if you use source map in the output options of Rollup:

const outputOptions = {
    sourcemap: true
};

Because you will get UnhandledPromiseRejectionWarning: Error: Multiple conflicting contents for sourcemap source on rebuilding after you have modified style or template block* of a component.

(v5.1.9)

*And for script block with v6.0.0 too.

@AlttiRi
Copy link

AlttiRi commented Aug 15, 2020

This poll request (not accepted) fixes this issue. But it applies only on 6.0.0. version of this plugin that works only with Vue 3.0.

Also I can note that "rollup-plugin-vue": "^6.0.0-beta.10" generates source map for virtual files even with needMap: true (with only debuggable template (only for raw html, not pug)):
qwe

Is it a bug? How to disable it?

@danielvy
Copy link

This bug should be reopened. It is still an issue with v6.0.0 and it is not the same bug as #248.

It prevents using watch mode when source maps are needed.

sfioritto added a commit to hammerstonedev/refine-frontends that referenced this issue Jan 17, 2022
…ltiple conflicting contents for sourcemap source" — according to this link I added needMap: false, to the vue rollup plugin, so I get the error but the page reloads now and it breaks sourcemaps for SFCs. vuejs/rollup-plugin-vue#238. Might be able to do better than this? Not sure.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests