简体   繁体   中英

How to call a particular min.js file after one min.js file using webpack?

I have 2 min.js files and I want to call a particular file that populates the store (redux-store) initially and then I want to render the contents of the second file that will be using the pre populated store. eg 2 files 'a' and 'b', 'a' contains a string for name in the store now after getting the string from the user display the string using file 'b'.

Is it possible to specify 'a' file as entry point in webpack initially and then when an event occurs like onClick etc 'b' file is specified as entry point and it gets executed to produce the b.min.js file that can be used to display?

Why you want to do that. Use one file it is faster, request for other file is not as fast as only one request.

In your display b file with components you need to require store and reducers and other files to compile the bundle.

If you are looking for extracting common packages as React, React Router you can use CommonsChunkPlugin.

If you have complicated initial state in store. Load it as JSON.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM