url() statement and source maps
See original GitHub issueHello,
I have read that in order to have source maps, I have to use absolute urls in the url('')
statement.
I did it this way :
body
background-image: url('/elements/assets/tmp_background.jpg')
It works when I remove the sourceMap option from the css loader, it does not if I activate it.
I think I might have failed somewhere on the absolute path point, do you have any ideas?
Here is my config file :
module.exports = {
devtool: 'source-map',
entry: [
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080',
path.resolve(__dirname, 'elements/main.js'),
],
output: {
path: 'dist',
publicPath: '/', // Prefix for all the statics urls
filename: 'bundle.js',
},
resolve: {
root: path.resolve(__dirname),
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader?presets[]=es2015',
},
{ test: /\.css$/, loaders: ['style', 'css'] },
{ test: /\.scss$/, loaders: ['style', 'css?sourceMap', 'sass?sourceMap'] },
{ test: /\.sass$/, loaders: ['style', 'css?sourceMap', 'sass?sourceMap&indentedSyntax=true'] },
{ test: /\.jade$/, loaders: ['ngtemplate', 'html', 'jade-html'] },
{ test: /\.(png|gif|jp(e)?g)$/, loader: 'url-loader?limit=8192' },
{ test: /\.(ttf|eot|svg|woff(2))(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=50000' },
],
},
};
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Webpack sass loader with sourcemaps and url statements
I have read that in order to have source maps, I have to use absolute urls in the url('') statement. I did it...
Read more >Should I Use Source Maps in Production? | CSS-Tricks
It's a valid question. A “source map” is a special file that connects a minified/uglified version of an asset (CSS or JavaScript) to...
Read more >Anatomy of source maps | Bugsnag Blog
Source maps help you debug errors in your JavaScript code by mapping minified code to your original source. Learn how source maps work...
Read more >SourceMap - HTTP - MDN Web Docs
The SourceMap HTTP response header links generated code to a source map, enabling the browser to reconstruct the original source and present ...
Read more >What are JavaScript source maps? - Jim Fisher
The idiom seems to be to keep the map URL next to the JavaScript URL, e.g. the map for https://foo.com/scripts/main.js is typically hosted ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jhnns sure, here you are:
https://github.com/blogfoster/webpack-sass-loader-issue
Please note, I’m not 100% sure that it’s
sass-loader
issue, could be related to some other dependent project. But repo clearly demonstrates it, try to open it with Chrome and Safari.If you disable source-maps, it works correctly both browsers.
For me the url breaks if I enable source maps. When I’m using the ExtractTextPlugin and enable source maps, there is just no source map available.