Answer the question
In order to leave comments, you need to log in
How not to load extra js files?
Example:
There is an online store consisting of 2 pages: main page and catalogue.
The functionality of the main page includes 1 js script with a weight of 1 kb, and a directory with 2 js scripts with a weight of 1 and 500 kb.
The logic of work is as follows: each page of the site has its own entry, which includes libraries that are taken out into separate files through optimization.splitChunks.
Question: How can I not load scripts from a directory on the main page using Webpack and the html-webpack-plugin plugin? Those. add only the necessary page entry script and its dependencies (libraries) in order to load these 500 kb only at the right time.
If I missed such functionality in the webpack or github documentation of the plugin, please send a link.
At the moment, the plugin takes the template and inserts into it all the js files received from webpack.
Answer the question
In order to leave comments, you need to log in
you need to write a script in php that will display the java scripts you need only on the main page, on others it will not
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question