This turns out to be really hard to do in practice. Generally speaking any time you use ExtractTextPlugin you get a ConcatSource which always has sourceAndMap available. The only case you don't get a source map is when another plugin generates a CSS file that uses RawSource or something similar. One such plugin is optimize-css-assets-webpack-plugin when you don't tell the CSS processor to generate a source map (e.g. cssProcessorOptions has no map entry).
Everything goes into ExtractTextPlugin and that ALWAYS generates something with a source map, even if it’s an empty one. The issue here is your css optimizer; it goes:
This turns out to be really hard to do in practice. Generally speaking any time you use
ExtractTextPlugin
you get aConcatSource
which always hassourceAndMap
available. The only case you don't get a source map is when another plugin generates a CSS file that usesRawSource
or something similar. One such plugin isoptimize-css-assets-webpack-plugin
when you don't tell the CSS processor to generate a source map (e.g.cssProcessorOptions
has nomap
entry).Everything goes into
ExtractTextPlugin
and that ALWAYS generates something with a source map, even if it’s an empty one. The issue here is your css optimizer; it goes:ExtractTextPlugin -> Optimizer -> Splitter
And that kills everything.
Original PR from @didi0613 here: https://github.com/metalabdesign/css-split-webpack-plugin/pull/23 We just include a test in this one and a bit more of an investigation into why things happened the way they did.