shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.43k stars 186 forks source link

Hashes in key for css files #225

Closed piernik closed 3 years ago

piernik commented 3 years ago

Expected Behavior

Using plugin with MiniCssExtractPlugin. Problem is with css files - they have hashes in keys. My entries are:

var entries = {
    "common": "./assets/js/blog/entries/index.ts",
    "style": "./assets/css/blog/style-blog.scss",
};

In manifest.json I want:

{
  "common.js": "/js/common.js",
  "style.css": "/js/../css/style.css",
  "style.js": "/js/style-c52b8cad.js",
}

webpack.config.js


const subdomain = 'blog';
const outputDir = 'public/' + subdomain;

const plugins = [
    new CleanWebpackPlugin(),
    new MiniCssExtractPlugin({
        filename: '../css/style.css',
    }),
    new ManifestPlugin({
        fileName: '../manifest.json',
    }),
];

module.exports = (argv, env) => {
    return {
        plugins: [
            ...plugins,
        ],
        entry: entries,
        output: {
            path: path.resolve(__dirname, outputDir + "/js/"),
            publicPath: "/js/"
        },
        optimization: {
            splitChunks: {
                chunks: "all",
                maxInitialRequests: 10,
                minChunks: 1,
                maxSize: 1000000,
                name: false,
            },
        },
        module: {
            rules: [
                {
                    test: /\.s[ac]ss$/i,
                    use: [
                        MiniCssExtractPlugin.loader,
                        'css-loader',
                        'sass-loader',
                    ],
                },
                {
                    test: /\.tsx?$/,
                    use: [
                        {
                            loader: 'ts-loader',
                            options: {
                                transpileOnly: true,
                            }
                        }
                    ],
                },
            ],
        },
        resolve: {
            extensions: ['.ts', '.tsx', '.js', '.jsx'],
        },
    };
};

Actual Behavior

My manifest.json:

{
  "common.js": "/js/common.js",
  "style-c52b8cad.css": "/js/../css/style.css",
  "style-c52b8cad.js": "/js/style-c52b8cad.js",
  "style-600e0d50.js": "/js/style-600e0d50.js"
}

Additional Information

shellscape commented 3 years ago

Thanks for opening an issue. Citing the issue template:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the REPL.it plugin reproduction template at https://repl.it/@shellscape/manifest-plugin-repro
  2. Provide a minimal repository link (Read https://git.io/fNzHA for instructions). Please use NPM for installing dependencies! These may take more time to triage than the other options.

    ⚠️ ZIP Files are unsafe and maintainers will NOT download them.

We cannot make this any clearer. Please add a reproduction and we'll be happy to triage further.

Also, please search issues before opening new ones. This has already been resolved in master.