Skip to content

Omitting standalone JS files from index.html #493

Answered by billdami
billdami asked this question in Q&A
Discussion options

You must be logged in to vote

If anyone comes across this, i figured it out. I had to overrided CRA's default HtmlWebpackPlugin config, adding the excludeChunks option:

const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    webpack: {
        configure: (webpackConfig, { env, paths }) => {
            const isEnvDevelopment = env === 'development';
            const isEnvProduction = env === 'production';

            return {
                ...webpackConfig,
                plugins: [
                    new HtmlWebpackPlugin(
                        Object.assign(
                            {},
                            {
                                inject: true,

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by billdami
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant