先安装css-loader、stylus、stylus-loader
npm install --save-dev css-loader
npm install --save-dev stylus
npm install --save-dev stylus-loader
webpack.config.js里的配置
module:{
rules:[
{
test: /\.css$/,
use: extractTextPlugin.extract({
fallback: "style-loader",
use: [{loader:"css-loader",options:{importLoaders:}},'postcss-loader']
})
},
{
test: /\.styl(us)?$/, //注意这块
use: extractTextPlugin.extract({
use: [{
loader: "css-loader"
}, {
loader: "stylus-loader"
}],
// use style-loader in development
fallback: "style-loader"
})
}
]
}