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

Can't change source-maps style (Webpack Devtool settings) #84

Open
jimblue opened this issue Oct 21, 2018 · 11 comments
Open

Can't change source-maps style (Webpack Devtool settings) #84

jimblue opened this issue Oct 21, 2018 · 11 comments

Comments

@jimblue
Copy link

jimblue commented Oct 21, 2018

Hi there!

I've notice that output source maps style doesn't respect webpack devtool settings when using this plugin.

While using css nano with post-css loader, source maps style perfectly match webpack configuration.

So I guess this issue is due to your plugin.

Thanks for you help!

Cheers

@dxx
Copy link

dxx commented Oct 22, 2018

I have the same problem.

When i use mini-css-extract-plugin plugin, even if pass sourceMap=true in css-loader, source maps are not output

@dxx
Copy link

dxx commented Oct 22, 2018

I resolved this problem by pass some options

new OptimizeCSSAssetsPlugin({
  cssProcessorOptions: { 
    map: { inline: false }
  }
})

@jimblue
Copy link
Author

jimblue commented Oct 22, 2018

Hi @code-mcx ,

I'm not saying source maps are not output ! (already configured the plugin as you suggest)

The problem is how source map are actually output.

Webpack offer different styles of source maps for production:

  • cheap-source-map
  • cheap-module-source-map
  • source-map
  • hidden-source-map
  • nosources-source-map

But changing this setting doesn't affect source map style when using this plugin!

This is a problem when you want to hide your source code while keeping all advantages of source map on a production server.

@jimblue jimblue changed the title Source-maps doesn't respect Webpack settings Source-maps doesn't respect Webpack Devtool settings Oct 22, 2018
@dxx
Copy link

dxx commented Oct 23, 2018

@jimblue
I'am sorry about i misunderstand your meaning.

@jimblue jimblue changed the title Source-maps doesn't respect Webpack Devtool settings Can't change source-maps style (Webpack Devtool settings) Oct 23, 2018
@SassNinja
Copy link

SassNinja commented Nov 9, 2018

I've just faced the same issue!
Sourcemaps got removed on minimization until I set the cssProcessorOptions.

However even with a working sourceMap I've got the same problem as @jimblue:
My settings for devtool are not considered.
I'm using nosources-source-map in production to hide my source code but when I use OptimizeCSSAssetsPlugin the whole sources are included in the map :(

@NMFR are there any plans to fix/improve this?

@SassNinja
Copy link

I've been able now to achieve my nosource-source-map by setting sourcesContent: false in the options.
However the sourcemap origin paths are now different:

  • without OptimizeCSSAssetsPlugin it's like webpack:///./node_modules/example/abc.scss
  • with OptimizeCSSAssetsPlugin it's like http://localhost:3030/Users/kfalkowski/myproject/assets/src/scss/app.scss

Still not happy with the result :/
I just want the minimization without touching the sourcemap. So far it seems using cssnano via the postcss-loader is the only way to achieve this.

@jimblue
Copy link
Author

jimblue commented Nov 9, 2018

Hey @NMFR, can we have your input about this issue!!
Thanks 😃

@NMFR
Copy link
Owner

NMFR commented Nov 20, 2018

Hi, sorry i don't have much time lately to work on this. I will take a look but i cant promise when. If you can and wish to help fell free to open a PR.

@abhijithvijayan
Copy link

abhijithvijayan commented Jan 7, 2019

@NMFR Removing Sourcemaps in Production is pretty much a good feature.

          cssProcessorOptions: { 
            map: false
          },

This works somehow.

@alexturpin
Copy link

+1, would be great for this to respect the devtool setting!

@galvarez421
Copy link

Related to #91 and #53 (comment).

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

7 participants