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

extract-text-webpack-plugin mangles minimized source maps #289

Closed
x-yuri opened this issue Nov 21, 2016 · 1 comment
Closed

extract-text-webpack-plugin mangles minimized source maps #289

x-yuri opened this issue Nov 21, 2016 · 1 comment

Comments

@x-yuri
Copy link
Contributor

x-yuri commented Nov 21, 2016

package.json:

{
  "dependencies": {
    "css-loader": "^0.26.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "html-webpack-plugin": "^2.24.1",
    "node-sass": "^3.13.0",
    "sass-loader": "^4.0.2",
    "style-loader": "^0.13.1",
    "webpack": "^1.13.3"
  }
}

webpack.config.js:

var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
    entry: './1.js',
    output: {
        path: 'dist',
        filename: 'bundle.js',
    },
    module: {
        loaders: [
            {test: /\.sass$/, loader: ExtractTextPlugin.extract('style', 'css?sourceMap&minimize!sass?sourceMap')},
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: 'template.ejs',
        }),
        new ExtractTextPlugin('[name].css'),
    ],
    devtool: 'source-map',
};

template.ejs:

<!doctype html>
<html>
<body>

<div>
    <div></div>
</div>

</body>
</html>

1.js:

require('./1.sass');

1.sass:

div
    width: 10px
    div
        width: 20px
$ npm i
$ rm -rf dist/* && ./node_modules/.bin/webpack

Then open http://example.com/dist in Chrome. Then Developer Tools > Elements tab. Then click on the inner div element, and then on the link for div div { width: 20px; } block. And you'll find yourself on the wrong line (line 4 instead of line 1).

If you disable extract-text-webpack-plugin, you'll be at line 1.

@x-yuri x-yuri changed the title extract-text-webpack-plugin mangles source maps extract-text-webpack-plugin mangles minimized source maps Nov 22, 2016
@x-yuri
Copy link
Contributor Author

x-yuri commented Nov 26, 2016

Closing in favour of mozilla/source-map#252. The issue is most likely with source-map package.

@x-yuri x-yuri closed this as completed Nov 26, 2016
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

1 participant