Multiple Webpack builds

Marcellin Nshimiyimana
Friday Knowledge
Published in
1 min readNov 7, 2021

This week, I learned how to run multiple webpack builds on same website sing jsonpFunction

There are times when you want to run multiple JavaScript applications on the same page.

For example, you have a main Angular app and a chat widget written in Reactjs.

If you are using Webpack v4, you will likely run into this code splitting issue.

As always, you have many solutions at your disposal!

  1. You can upgrade your Webpack, which (in my experience) is always a time consuming for big teams.
  2. You could also dig into Webpack documentation and after a day, you realize that there is a config option (jsonpFunction) that you can use!

Conclusion

Webpack can help you achieve almost any build process that suits your need. However, be prepared to spend a bit of time on its documentation.

Checkout this repo for details on the issue and the fix

Resource:

--

--

Marcellin Nshimiyimana
Friday Knowledge

Always debugging, because problem knowledge equals half the solution!