Answer the question
In order to leave comments, you need to log in
How to fix webpack relative path issues with sass-loader?
I have a problem when there are styles in sass files with this code:
app.scss
body {
background: url(/img/test.png) no-repeat;
}
import './body.scss';
/*
.. js code
*/
body {
background: url(~/img/test.png) no-repeat;
}
body {
background: url(img/test.png) no-repeat;
}
module.exports = {
context: __dirname, // точка входа в приложение
entry: { // точки входа
core: './angular/vendor.js',
app: './angular/app.module.js'
},
output: { // выходные файлы
path: '../webapp/js/',
publicPath: '/js/',
filename: '[name].js',
library: '[name]'
},
module: {
loaders: [
{ // используем ES6 to ES5
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015'],
compact : false
}
},
{
test: /\.html$/,
loader: 'html'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'resolve-url', 'sass?sourceMap']
}
]
},
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question