webpack - Webpack scss意外字符'@'
问题描述
这是我的 webpack.config.js
const ExtractTextPlugin = require('extract-text-webpack-plugin');
rules:
{
test: /\.(sass|scss)$/,
include: path.resolve(__dirname, 'src/scss'),
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin({
filename: './dist/bundle.css',
}),
],
我得到了这个错误:
Module parse failed: Unexpected character '@' (4:0)
You may need an appropriate loader to handle this file type.
> @import 'base/grid';
在 css-loader 文档中写道它翻译了@import,那么为什么我会收到这个错误?
解决方案
推荐阅读
- alfresco - Alfresco:很少有数据库文件损坏
- c# - C# 继承 - 更新基类
- r - “ifelse grepl”循环的更紧凑版本
- neo4j - 在 Cypher 查询中处理空值
- html - Bootstrap 4向col添加边距
- amp-html - Onclick 功能在我的 AMP 网站上不起作用
- php - 按钮通过 GetElementByType 或 Value 单击 WebBrowser vb.net
- javascript - 为什么我的 Modal.show() 函数在触发一秒后意外关闭?
- akka-persistence - Lagom / Akka readside 处理器
- ember.js - Ember Fastboot / 不要导入 node_modules 脚本