Adding requirejsExclusionRegExp to the optimizer file

I am currently using the following to exclude r.js and build.js files from an optimized build.

fileExclusionRegExp: /^(r|build)\.js$/ 

How can I add to this to exclude a directory or other files with specific extensions? Should I use this option for this or is there another way to handle this. In particular, I would like to exclude these two js files and the whole directory.

+4
source share
1 answer

You can combine several exceptions in one regex pattern with the | . For instance:

 fileExclusionRegExp: /.psd$|sound/ 

This excludes all .psd files and the sound directory.
But keep in mind that it will delete any file containing sound in the absolute file name, not only .../sound/... , but .../sound.js . I could not figure out how to include slashes in the template. Normal shielding does not work here. Therefore, make sure that you do not have such name conflicts.

+3
source

Source: https://habr.com/ru/post/1496385/


All Articles