A
A
Alexander Alexandrovich2017-08-13 17:13:31
webpack
Alexander Alexandrovich, 2017-08-13 17:13:31

How to merge 2 webpack files?

Good afternoon, please tell me:
There are 2 js files that are collected by webpack, one contains the main libraries, the second contains the functions themselves, events, etc.
When I load them into the page:

<script src="main.js" type="text/javascript"></script>
<script src="sup.js" type="text/javascript"></script>

Some functions from main.js are available and some are not. If you combine two files into one, then everything is fine.
If you paste the code from sup.js directly into the console, then everything is fine. Tried to wrap in window.onload does not help.
I think the problem is that webpack wraps the code making it unavailable, if my guess is correct, how can I disable this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Shanin, 2017-08-14
@JoyMefisto

To expose the module created by webpack "outside", you need to add the webpack.config.js assembly. This property creates a variable in the global scope for each bundle, where it saves the entire bundle. library: '[name]'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question