V
V
Vitaly Stolyarov2018-04-16 03:20:46
webpack
Vitaly Stolyarov, 2018-04-16 03:20:46

How to preload a single bundle generated in Webpack 4?

Webpack 3 example: https://github.com/Ni55aN/allmatter/blob/master/we...
The splash.js module is generated separately and executed in the head.
If you try to transfer this to Webpack 4 by replacing the plugin, you get the following:
splash.js is not executed in the head, but only when all bundles are loaded, although it is necessary that it be executed before loading.
What has been tried:

entry: {
            splash: './src/splash.js',
            app: './src/app.js'
        },

optimization: {
            splitChunks: {
                cacheGroups: {
                    commons: {
                        chunks: 'all',
                        minChunks: 2,
                        maxInitialRequests: 5,
                        minSize: 0
                    },
                    vendor: {
                        test: /node_modules/,
                        chunks: 'initial',
                        name: 'vendor',
                        priority: 10,
                        enforce: true
                    }
                }
            }
        },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2014-03-23
@OnYourLips

You do something interesting yourself and don’t bring it to the university, but ask your supervisor for the topic of your diploma.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question