Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Possibility to disable css source maps #235

Closed
vladshcherbin opened this issue Aug 22, 2016 · 5 comments
Closed

Possibility to disable css source maps #235

vladshcherbin opened this issue Aug 22, 2016 · 5 comments

Comments

@vladshcherbin
Copy link

vladshcherbin commented Aug 22, 2016

I'm using webpack with config:

module.exports = {
  devtool: 'hidden-source-map',
  ...
  module: {
    loaders: [
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract({
          loader: ['css?minimize', 'postcss', 'sass?{precision:10}'],
          publicPath: '/static/'
        })
      }
    ]
  },
  postcss: [autoprefixer({ browsers: ['last 2 versions'] })]
}

Source map is created automatically, but I don't need it. Besides, produced css file has no path for source map in it and produced source map is useless:

{"version":3,"sources":[],"names":[],"mappings":"","file":"css/file.css","sourceRoot":""}

Is there an option to disable its creation?

@jiayihu
Copy link

jiayihu commented Feb 15, 2017

I was able to disable sourcemaps for CSS files using devtool: false, whereas nosources-source-map had the same problem.

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Apr 22, 2017

This is an issue in css-loader, we will fix soon. css-loader PR is here

@mnpenner
Copy link

I don't understand. I have all my sourcemaps turned off:

let cssLoaders = [
    {
        loader: 'css-loader',
        options: {
            // sourceMap: false,
            root: publicDir.replace(/\\/g, '/'),
            localIdentName: '[name]_[local]--[hash:base64:5]',
            minimize: !isWDS,
            sourceMap: false,
        }
    },
    {
        loader: 'postcss-loader',
        options: {
            sourceMap: false,
            plugins: loader => [
                require('autoprefixer')({browsers: supportedBrowsers}),
            ],
        }
    },
];

let lessLoaders = [
    ...cssLoaders,
    {
        loader: 'less-loader',
        options: {
            sourceMap: false,
            strictMath: true,
            strictUnits: true,
        },
    },
];

I'm using css-loader 0.28.11.

I do not want to turn my devtool off. I still want sourcemaps for JavaScript. I'm using webpack 3. The PR has been merged.

@alexander-akait
Copy link
Member

@mnpenner use sourceMap: true for all loaders

@mnpenner
Copy link

@evilebottnawi But I want them off because the sourcemaps don't work anyways.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants