【发布时间】:2015-11-19 14:01:26
【问题描述】:
我不知道如何使用 webpack sass-loader 渲染 css 文件。
这是我的 webpackconfig.js 的样子:
module.exports = {
context: __dirname + "/app",
entry: {
javascript: "./app.js",
html: "./index.html"
},
output: {
filename: "app.js",
path: __dirname + "/dist"
},
module: {
loaders: [
//JAVASCRIPT
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ["babel-loader"],
},
//Index HMTML
{
test: /\.html$/,
loader: "file?name=[name].[ext]",
},
//Hotloader
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ["react-hot", "babel-loader"],
},
// SASS
{
test: /\.scss$/,
loader: 'style!css!sass'
}
],
}
}
如您所见,我正在使用文档中指定的 sass-loader 模块加载器。
{
test: /\.scss$/,
loader: 'style!css!sass'
}
我的根是这样的:
Project Root:
app:
style.scss
dist:
?????? WTF is my css file??
webpack.config.js
我可以让其他一切工作,例如 html 和 jsx babble loader。 我只需在命令行中输入 webpack,事情就会发生。
我的 sass 加载程序有问题。 它是什么? 请帮忙。
【问题讨论】: