Mini-css-extract-plugin: Document the sourceMap option in README

Created on 25 Sep 2018  Â·  7Comments  Â·  Source: webpack-contrib/mini-css-extract-plugin

Hi!

Currently the sourceMap option is not mentioned in the README:
https://github.com/webpack-contrib/mini-css-extract-plugin/blob/aa993daa12a45a326abcdd4f19dcba76db35ed8a/src/index.js#L29

I presume it's required to be set to true to enable source maps, so it seems important to mention it in the README, given at the moment the top of the readme says "It supports On-Demand-Loading of CSS and SourceMaps" - which isn't true out of the box.

help wanted 4 (nice to have) docs

All 7 comments

@evilebottnawi,

It's very unclear at the moment whether or not this needs to be set in the loader options for MCEP.

  • README – not set.
  • Test – set.
  • Example from you – not set.
  • My own code – not (yet) set (but seems to work)

What is the default value? Is it inherited from another loader or the webpack options?

Hi!

I have set the option to false to stop generating source maps, but it doesn't work as I expected.

Is the option sourceMap a "broken" option so that it is not documented ? Any other ways to disable source maps?

PR welcome

I don't believe sourceMap is an accepted plugin option. That sourceMap parameter in the quoted line is for the constructor of a CssDependency class, not the main plugin. I believe CssDependency is used to receive data from the previous loader (most likely css-loader), and so the sourceMap parameter is to receive the sourcemap (data/filename?) from css-loader.

@evilebottnawi if you can clarify whether sourceMap is a valid option or not, I think someone can then submit a PR to update the documentation :wink:

@evilebottnawi please clarify the use of sourceMap option so we can eventually send PR. Thanks.

Sorry for big delay, plugin doesn't have the sourceMap option, we don't need the option here, if you need disable source maps you need disable source maps on previous loader (i.e. css-loader). Also we improve 0CJS configuration, in next release css-loader will be emit source maps if you set devtools not false

Unfortunately we have another bug with source maps https://github.com/webpack-contrib/mini-css-extract-plugin/issues/223, you can disable a source map generation using devtools: false and sourceMap: false on css-loader, we will try to fix it in webpack@5

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ripperdoc picture ripperdoc  Â·  3Comments

stavalfi picture stavalfi  Â·  4Comments

mike1808 picture mike1808  Â·  3Comments

grrowl picture grrowl  Â·  3Comments

Legends picture Legends  Â·  4Comments