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
WebPack 2 no source maps #309
Comments
I'm having this same issue. Any assistance in this matter would be greatly appreciated. Here's my config: devtool: (env === 'development') ? 'source-map' : false,
...
{
test: /\.(sass|scss)$/,
include: path.join(__dirname, 'src/sass'),
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: [
{
loader: 'css-loader',
query: {
minimize: (env === 'production'),
modules: true, // enables CSS Modules spec
sourceMap: (env === 'development'),
importLoaders: 2, // will import previous amount of loaders
},
},
'postcss-loader',
{
loader: 'sass-loader',
query: {
sourceMap: (env === 'development'),
sourceMapContents: (env === 'development'),
},
},
],
}),
},
... |
@folmert This is the new syntax shown in Webpack 2 config file: https://webpack.js.org/configuration/. FWIW, I do get source maps to the compiled CSS file but not back to the original SCSS file. I tested without using the ExtractTextPlugin and have the same issue. |
Does somebody solved this issue for webpack2. |
Works for me using
|
+1 same issue here |
On survivejs the author advises to enable sourcemaps for every loader, which solved the issue for me.
|
Its configured directly for the sass loader. but no source maps are in the output. This is how i did it:
|
It seems to be working when using the ExtractTextPlugin. But not without. If used a loader directly. |
Do you also use the the css-loader? |
For me, I had to upgrade ExtractTextPlugin to the latest version (as of now, rc3). |
Same issue, none of the above suggested solutions worked for me. ...
{
test: /\.scss$/,
exclude: [helpers.root('src', 'app')],
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [{
loader: 'css-loader',
query: {
modules: false,
sourceMap: true,
importLoaders: 2
}
}, {
loader: 'postcss-loader'
}, {
loader: 'sass-loader',
query: {
sourceMap: true,
sourceMapContents: true
}
}]
})
},
... |
@jhnns Thank you, rookie mistake, I've corrected my comment as well. |
Any progress on this? |
@aeharding could you provide your webpack config? Anyone using Bootstrap 4? I only get invalid entries in the sourcemap from Bootstrap scss I import.
|
Try this: |
Closing this one since it is not an actual bug description. We know that source maps do work with webpack 2 and sass-loader. However, there can be issues depending on the language features you are using, like #351 |
For the "throw new Error('Invalid mapping: ' + JSON.stringify", it appears this may be related to sass/libsass#2312 |
@hvalcourtSerdy The known problem, unfortunately it has not been solved for a long time |
I faced the same problem, but after reading this part of the post-css docs, I figured everything out... use: [
{
loader: 'css-loader',
options: { sourceMap: true, importLoaders: true, }
},
{
loader: 'postcss-loader',
options: {
sourceMap: 'inline',
plugins: function() {
return [ require('autoprefixer') ]
}
}
},
{
loader: 'sass-loader',
options: { sourceMap: true }
},
], |
I'm using Webpack config devtool: This is a working config without postCSS:
Found here |
@kang-chen your config is invalid, why your use |
@evilebottnawi thanks for the recommendation, corrected with |
@kang-chen devtool : "source-map" worked well. Only concern is it might affect performance of JS bundle as well. |
I'm unable to get source maps to work. Here is my config file:
The text was updated successfully, but these errors were encountered: