A
A
Architecktor133472018-11-03 14:09:38
webpack
Architecktor13347, 2018-11-03 14:09:38

How to properly organize file connection in JS?

I'm building js scripts with webpack. For each page, I organize my own base file, in which I include ready-made pieces of code, and this file is already assembled into the final script to be sent to the client. The problem is that different packages may require the inclusion of the same pieces of code. How to organize the connection correctly?
1) Through import or require?
2) Should all the required dependencies be included in the base file or in each file that has dependencies, should each of them be included?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex, 2018-11-03
@Architector13347

webpack.js.org/guides/code-splitting/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question