Webpack:导入 CSS

Webpack : Import CSS

我对 CSS 有疑问。我正在使用 this config,我想通过 import '@fullcalendar/core/main.css';.

在我的脚本中导入 CSS

我有以下错误:

        Module parse failed: Unexpected character '@' (1:0)
        You may need an appropriate loader to handle this file type.
        @charset "UTF-8";
        | .fc {
        |   direction: ltr;
        @ ./assets/js/admin/admin.js 4:0-37

感谢您的帮助。

以下配置适合我

module: {
        rules: [{
                test: /\.css$/,
                use: [
                    'style-loader',
                    MiniCssExtractPlugin.loader,
                    {
                        loader: "css-loader",
                        options: {
                            minimize: true,
                            sourceMap: true
                        }
                    }
                ]
            }
        ]
    }

然后在你的 js 文件中导入类似这样的东西

import "css/Admin/admin.css";