Skip to content

Option to disable cache busting with sourceMap enabled #987

Closed
@Zizaco

Description

@Zizaco

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 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions