webpack-fix-style-only-entries
发布于 1 个月前 作者 qjzd 113 次浏览 来自 码农

github地址

https://github.com/fqborges/webpack-fix-style-only-entries 解决当打包只有css时,还额外会出现一个js文件的问题

使用

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const FixStyleOnlyEntriesPlugin = require("webpack-fix-style-only-entries");

module.exports = {
    entry: {
        "main" : "./app/main.js"
        "styles": ["./common/styles.css", "./app/styles.css"]
    },
    module: {
            {
                test: /\.css$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                ]
            },
        ]
    },
    plugins: [
        new FixStyleOnlyEntriesPlugin(),
        new MiniCssExtractPlugin({
            filename: "[name].[chunkhash:8].css",
        }),
    ],
};

问题描述

https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/518

回到顶部