Webpack出现意外字符“ @”

时间:2018-09-23 02:16:41

标签: webpack

我遇到了如下所示的webpack

ERROR in ./css/style.css 1:0
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.

这是我的style.css

@import url("https://fonts.googleapis.com/css?family=Oxygen:400,300,700");
* {
  outline: 0;
  margin: 0;
  padding: 0;
}

我认为问题是来自style.css的“ @”。

如何添加一些加载程序来解决此问题?

这是我的webpack.config.js

const path = require('path');

module.exports = {
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.css$/,use: [ 'style-loader', 'css-loader' ],
                test: /\.(png|jpg|gif)$/,use: [ 'url-loader' ]
            }
        ]
    }
};

0 个答案:

没有答案