Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable cache busting with sourceMap enabled #987

Closed
Zizaco opened this issue Sep 21, 2017 · 3 comments
Closed

Option to disable cache busting with sourceMap enabled #987

Zizaco opened this issue Sep 21, 2017 · 3 comments

Comments

@Zizaco
Copy link

Zizaco commented Sep 21, 2017

What problem does this feature solve?

I strongly believe that an option to disable cache busting for hot-reload would solve a problem that many are having.

In loader.js:81 the this.sourceMap always triggers the cache busting of filenames, even when trying to generate code-coverage. Where one would want to have:

  • Precise filenames (without the "?[cache-key]" thing)
  • An actual SourceMap

So, at the end, ironically, when source-map is enabled in webpack, vue-loader informs wrong filenames to code-coverage reports. For example:

/path/to/project/src/components/MyComponent.vue?7b4a5b1a
// instead of
/path/to/project/src/components/MyComponent.vue

Forcing people to do "workarounds" to get the real filename. For example:
https://github.com/mattlewis92/karma-coverage-istanbul-reporter/pull/3/files#diff-ff384da5c93b71dffa19fa30af8e2a2cR48

End user experience

Today the setup to get proper code-coverage of vue components is more complicated than it should.

With an option to disable cache busting in source-map filenames, code-coverage of .vue files would be as easy as $ nyc mocha-webpack test/**/*.spec.js with a reasonable simple webpack config (even without karma).

Evidence that this is a problem

There are many people struggling with this 😢 (my team included):

What does the proposed API look like?

options: {
  cacheBusting: false // true by default (:
}
...

Because source-map !== cache busting for hot-reload 😅

@kriansa
Copy link

kriansa commented Sep 25, 2017

After trying to setup webpack and mocha with a similar setup, I have also faced this issue.

This makes the filename be set to a invalid name, making istanbul html output broken due the absence of the "file".

@kriansa
Copy link

kriansa commented Oct 1, 2017

In case anyone needs it, I've done the proposed changes here.

@infn8
Copy link

infn8 commented Dec 21, 2020

This is still happening for me. the issue I have is not coverage libraries like istanbul but just editing options in developer tools. Using css in js is great but with sourcemaps on, changing anything in devtools breaks the site because all the filenames become wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants