无法将多个 scss 文件提取到一个 css 文件

Cannot extract multiple scss files to one css file

我好像不知道如何将多个.scss文件提取到一个.css文件中。构建后,我的 /dist 文件夹仅包含 .js 文件。我遵循了许多指南,但没有一个有效。这是我的 webpack.config.js

module.exports = {
    entry: {
        index: ["./src/app/index.ts"],
        background: ["./src/background/background.ts"]
    },
    watch: true,
    watchOptions: {
        aggregateTimeout: 300,
        ignored: /node_modules/
    },
    output: {
        filename: "[name].js",
        path: path.resolve(__dirname, "dist")
    },
    module: {
        rules: [
            {
                test: /\.ts?$/,
                loader: "awesome-typescript-loader",
                exclude: [/\/node_modules\//]
            }, {
                test: /\.html$/,
                loader: "html-loader"
            }, {
                test: /\.scss$/,
                use: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    //resolve-url-loader may be chained before sass-loader if necessary
                    use: ['css-loader', 'sass-loader']
                })
            }
        ]
    },
    plugins: [
        new CopyWebpackPlugin([
            {
                from: "manifest.json",
                to: "./"
            }, {
                from: "./node_modules/jquery/dist/jquery.js",
                to: "./"
            }
        ]),
        new ExtractTextPlugin('style.css'),
        new CleanWebpackPlugin("dist"),
    ],
    resolve: {
        extensions: [".ts", ".js"]
    }
};

@edit 我有最新的模块:

你试试这个方法吗?
1) 创建 styles.scss,其中包含您需要的所有 scss 导入:

2) 创建文件: all-styles.js:

import style1 from "./styles/styles.scss";

3) 添加所有-styles.js 作为您的入口点:

entry: {
    index: ["./src/app/index.ts"],
    background: ["./src/background/background.ts"],
    styles: ["./src/all-styles.js"]
},