Can I only combine js files with encore?

710 Views Asked by At

I have symfony project with twitter bootstrap template (hardcoded assets in twig). I would like manage assets with Encore, but if encore process file, make module and next compilation magic.

Is any way how to config Encore for only combine js, without compilation?

Basic install Encore: https://symfony.com/doc/current/frontend/encore/installation.html

...and my idea, in file app.js:

include '1-file.js'; // alert(1);
include '2-file.js'; // alert(2);

and output in twig:

merged.js // alert(1); alert(2);

thanks for any advice

1

There are 1 best solutions below

0
On

I have been working with encore for many months, when you run yarn build or npm run build, encore minimize those files. In webpack.config.js you have an option called enableSingleRuntimeChunk(). This option says to the system that, in case of a big file, encore will split the file in two for optimize the process. If you want to disable, remove the previous line and write .disableSingleRuntimeChunk().

Don't forget to run encore again to save this changes!!