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

[2.0.5] Warnings about missing sourcemap when they are enabled (options.sourceMap) #248

Closed
danyim opened this issue May 31, 2017 · 14 comments

Comments

@danyim
Copy link

danyim commented May 31, 2017

I'm seeing these warnings:

 ⚠️  PostCSS Loader

Previous source map found, but options.sourceMap isn't set.
In this case the loader will discard the source map enterily for performance reasons.
See https://github.com/postcss/postcss-loader#sourcemap for more information.

when my Webpack config explicitly sets the option to true:

      {
        test: /\.(scss|sass)$/,
        loader: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 2,
                sourceMap: true,
                modules: CSSModules,
                context: path.join(process.cwd(), './src'),
                localIdentName: isDev ? '[name]__[local].[hash:base64:5]' : '[hash:base64:5]',
                minimize: !isDev
              }
            },
            {
              loader: 'postcss-loader',
              options: {
                sourceMap: true
              }
            },
            {
              loader: 'sass-loader',
              options: {
                outputStyle: 'expanded',
                sourceMap: true,
                sourceMapContents: !isDev
              }
            }
          ]
        })
      },

Is there something I am misconfiguring? Or is this a bug? Also, "enterily" is typoed in the warning text.

@yoyo837
Copy link

yoyo837 commented May 31, 2017

(Emitted value instead of an instance of error)
the same, when i use postcss-loader vue-cli@2+ (*.scss or other,not *.vue)

@yoyo837
Copy link

yoyo837 commented May 31, 2017

@danyim look at this
159b66a

I switch to a low version @1.3.3

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 31, 2017

@danyim The typo should be fixed on master already, thx 😛 . Can you try without sourceMapContents: !isDev in sass-loader options? I will test it in a few minutes

@michael-ciniawsky
Copy link
Member

@danyim I can't reproduce this in a small local test, could you please setup a small repo for debugging ?

@michael-ciniawsky michael-ciniawsky self-assigned this May 31, 2017
@michael-ciniawsky michael-ciniawsky changed the title Warnings about options.sourceMap not set when they are [2.0.5] Warnings about missing sourcemap when they are enabled (options.sourceMap) May 31, 2017
@michael-ciniawsky
Copy link
Member

Feel free to reopen if still regressions and please provide a small test repo, since I couldn't reproduce this myself

@Janaka-Steph
Copy link

Janaka-Steph commented Jun 28, 2017

Hello,

Postcss-loader: 2.0.6
Webpack: 2

I still have the warning "Previous source map found, but options.sourceMap isn't set."
Here is part of my webpack.config.js :

module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.scss$/,
        use: [
          'style-loader',
          'css-loader?module&importLoaders=1&localIdentName=[local]_[hash:base64:5]',
          'postcss-loader',
          'sass-loader?sourceMap'
        ]
      },
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
          plugins: [
            //'transform-react-jsx',
            [
              'react-css-modules',
              {
                "generateScopedName": "[local]_[hash:base64:5]",
                "filetypes": {
                  ".scss": "postcss-scss"
                },
                "webpackHotModuleReloading": true
              }
            ]
          ]
        },
      }
}

Thank you for your help

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Jun 28, 2017

@Janaka-Steph sass-loader (generates map) => postcss-loader (gets prev map from sass-loader, but doesn't update it, without ?sourceMap) => ⚠️

+ 'postcss-loader?sourceMap',
  'sass-loader?sourceMap'

@matthopson
Copy link

@Janaka-Steph I got around this by adding sourceMap: true to my postscss-loader config - so in your case, adding ?sourceMap to postcss-loader may help.

@matthopson
Copy link

Dah! @michael-ciniawsky wins the day! 🌮 🌮 for you.

@Janaka-Steph
Copy link

No it doesn't work for me :-(
I tried what you said, I tried sourceMap everywhere, nowhere, in postcss.config, true, false. Nothing works. I don't know what to do

@matthopson
Copy link

matthopson commented Jun 28, 2017

@Janaka-Steph Here's exactly what I changed in my config to get rid of the warning.

{
      test: /\.scss$/,
      use: [
        'style-loader',
        cssModulesLoader,
        {
          loader: 'postcss-loader',
          options: {
            ident: 'postcss',
            sourceMap: true, // <-------- Added this line
            plugins: () => postcssConfig
          }
        },
        'sass-loader?sourceMap'
}

@Janaka-Steph
Copy link

Janaka-Steph commented Jun 28, 2017

Nope :-/
I print the error, maybe you understand something at this.

client?cd17:43 ./~/css-loader!./~/postcss-loader/lib!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?sourceMap!./~/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":4,"preBootstrapCustomizations":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/pre-customizations.scss","bootstrapCustomizations":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/customizations.scss","appStyles":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/app.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","postcss-loader","sass-loader"],"styles":["mixins","normalize","print","reboot","type","images","code","grid","tables","forms","buttons","transitions","dropdown","button-group","input-group","custom-forms","nav","navbar","card","breadcrumb","pagination","jumbotron","alert","progress","media","list-group","responsive-embed","close","badge","modal","tooltip","popover","carousel","utilities"],"scripts":["alert","button","carousel","collapse","dropdown","modal","popover","scrollspy","tab","tooltip","util"],"configFilePath":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/.bootstraprc","bootstrapPath":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/~/bootstrap","bootstrapRelPath":"../bootstrap"}!./~/bootstrap-loader/no-op.js
(Emitted value instead of an instance of Error) 

 ⚠️  PostCSS Loader

Previous source map found, but options.sourceMap isn't set.
In this case the loader will discard the source map entirely for performance reasons.
See https://github.com/postcss/postcss-loader#sourcemap for more information.


 @ ./~/style-loader!./~/css-loader!./~/postcss-loader/lib!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?sourceMap!./~/bootstrap-loader/lib/bootstrap.styles.loader.js?{"bootstrapVersion":4,"preBootstrapCustomizations":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/pre-customizations.scss","bootstrapCustomizations":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/customizations.scss","appStyles":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/ui/assets/theme/app.scss","extractStyles":false,"styleLoaders":["style-loader","css-loader","postcss-loader","sass-loader"],"styles":["mixins","normalize","print","reboot","type","images","code","grid","tables","forms","buttons","transitions","dropdown","button-group","input-group","custom-forms","nav","navbar","card","breadcrumb","pagination","jumbotron","alert","progress","media","list-group","responsive-embed","close","badge","modal","tooltip","popover","carousel","utilities"],"scripts":["alert","button","carousel","collapse","dropdown","modal","popover","scrollspy","tab","tooltip","util"],"configFilePath":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/.bootstraprc","bootstrapPath":"/Users/steph/Desktop/PRO/Projects/dao1901_NewDawn/~/bootstrap","bootstrapRelPath":"../bootstrap"}!./~/bootstrap-loader/no-op.js 4:14-1454 18:2-22:4 19:20-1460
 @ ./~/bootstrap-loader/lib/bootstrap.loader.js!./~/bootstrap-loader/no-op.js
 @ ./~/bootstrap-loader/loader.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server bootstrap-loader

Maybe it is due to bootstrap-loader ?

Here is the repo if you want to have a look: https://github.com/asseth/dao1901/tree/develop

@yoyo837
Copy link

yoyo837 commented Jul 7, 2017

@michael-ciniawsky
I created one, too.
Here is the repo if you want to have a look: https://github.com/yoyo837/postcss-loader-248

@adi518
Copy link

adi518 commented Feb 25, 2018

@matthopson That doesn't fix the problem properly. The a source map is needed for production, so by enabling it in development environment, you are increasing the build time, because it has to generate a Source map, which is really not needed, because while developing, your CSS is not minified.

So far, the only thing that fixes it for me is moving to postcss-loader@1.3.3.

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

6 participants