happypack
happypack copied to clipboard
SASS loader error if import css file in sass
my config
` {
loaders: [{ loader: ExtractTextPlugin.extract('style', 'happypack/loader?id=sass') }],
plugins: [new HappyPack({
id: 'sass',
loaders: [ 'css-loader?sourceMap&-convertValues', 'sass-loader?sourceMap' ] })]
} `
in .scss file
@import '../img_sprites/css/webim.css';
error info
ERROR in ./webim/im.scss Module build failed: ModuleParseError: Module parse failed: /Users/zhangyili/workspace/iwjw-pc/img_sprites/css/webim.css Unexpected token (1:0) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (1:0)
if i delete @import '../img_sprites/css/webim.css';
it works
I have the same thing with less, it all works when i have the less-loader without happypack. Using version 2.2.1. This is my config
module.loaders:{
{
test: /\.css$/,
include: resourceIncludes,
loader: ExtractTextPlugin.extract('style-loader', 'happypack/loader?id=css')
}, {
test: /\.(less)$/,
include: resourceIncludes,
loader: ExtractTextPlugin.extract('style-loader', 'happypack/loader?id=less')
}
}
plugins:[
createHappyPlugin('less', ['css-loader!less-loader']),
createHappyPlugin('css', ['css-loader'])
]
function createHappyPlugin(id, loaders) {
return new HappyPack({
id: id,
loaders: loaders,
threadPool: happyThreadPool,
cache: true,
verbose: true,
});
}
I solved this problem as follow
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style", "happypack/loader?id=css")
},
{
test: /\.scss/,
loader: ExtractTextPlugin.extract("style", 'css?minimize', "happypack/loader?id=scss")
},
{
test: /\.js$/,
loader: 'happypack/loader?id=js',
exclude: /node_modules/,
include: __dirname,
}
]
},
plugins: [
createHappyPlugin('css', ['css?minimize']),
createHappyPlugin('scss', ['sass'])
]
What's the status on this? Is it fixed by the 4.0.0 release?