Skip to content

Omitting standalone JS files from index.html w/CRACO #13020

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: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by billdami
Comment options

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