我需要编一本书和玉石。
我为sass找到了一个选择,但不起作用。只在启动时编译。
我试过以下命令:
但是它只在这样一个命令之后编译:
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
sourceMapFilename: '[name].map'
},
devtool: "source-map",
devServer: {
hot: true, // Tell the dev-server we're using HMR
contentBase: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader"
}, {
test: /\.sass$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}
]
}
};
我怎样才能解决我的问题?
发布于 2019-06-03 18:06:01
您对sass文件的测试应该可以很好地从sass编译到css。我建议首先尝试删除针对css的单独测试,因为您的sass测试应该已经编译到css,而附加的css测试可能会破坏某些东西。
因此,为您的module部分尝试以下配置:
module: {
loaders: [
{
test: /\.sass$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}
]
}https://stackoverflow.com/questions/45221524
复制相似问题