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

Instructions regarding source maps are incorrect #150

Closed
WishCow opened this issue Aug 17, 2015 · 6 comments
Closed

Instructions regarding source maps are incorrect #150

WishCow opened this issue Aug 17, 2015 · 6 comments

Comments

@WishCow
Copy link

WishCow commented Aug 17, 2015

The README says that you have to use the extract-text-webpack-plugin to get source maps working, however that is not entirely correct. You can get it working that way, but that will make it impossible to get livereload (or hmr) working.

After following the conversion in a closed ticket webpack-contrib/extract-text-webpack-plugin/issues/30, @sokra said that the extract-text plugin is not supposed to be used in development. If you want to get sourcemaps working, you just have to add ?sourceMap to both the css loader, and the scss loader, like this:

{
  test: /\.scss$/,
  loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
}

This will allow both live reloading, and sourcemaps to work, without involving the extract-text plugin at all. It does have a bit of a weird file name in Chrome, but clicking on it takes you to the correct file and line number. From my rudimentary testing, the value of the "devtool" flag doesn't seem to effect the generated sourcemaps at all, it works for me with both "eval", "source-map".

chrome sourcemaps

@yantakus
Copy link

When I use autoprefixer-loader it produces even more weird source path:

zsfjq6z

Here is my webpack config:

var AUTOPREFIXER_BROWSERS = '"ie >= 10","ie_mob >= 10","ff >= 30","chrome >= 34","safari >= 7","opera >= 23","ios >= 7","android >= 4.4","bb >= 10"';

loaders: [
  "style-loader",
  "css-loader?sourceMap",
  "autoprefixer-loader?{browsers:[" + AUTOPREFIXER_BROWSERS + "]}",
  "sass-loader?sourceMap"
]

@yantakus
Copy link

@jhnns, could you please explain what did you change to resolve the issue with source maps paths?

@jhnns
Copy link
Member

jhnns commented Sep 30, 2015

The weird paths are created by the css-loader. Take a look at my PR for further information.

@yantakus
Copy link

@jhnns, your link points to 404 page.

@jhnns
Copy link
Member

jhnns commented Oct 23, 2015

@yantakus
Copy link

Thank you, it works perfectly for me!

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

Successfully merging a pull request may close this issue.

3 participants