首页 > 解决方案 > 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,那么为什么我会收到这个错误?

标签: webpacksass

解决方案


推荐阅读