I have a large-scale client-side project which I would like to bundle into 2 bundles instead of 1.
This is my dependency tree:
The desired output would be to have these bundles:
main
that includesb
x
that includes justa
(asb
is already included in the first bundle and I do not want users to download more than once a piece of code).
Here's my optimizer configuration:
({
appDir: 'www',
baseUrl: 'js/',
mainConfigFile: 'www/js/require.config.js',
dir: 'www-release',
modules: [
{
name: 'main',
exclude: ['x']
},
{
name: 'x',
exclude: ['main']
}
],
optimize: 'none',
removeCombined: true
})
I do want to exclude from main
the whole dependency tree of x
, yet still include modules that I explicitly require, such as a
.
I know that:
include
— explicitly include module that are not required directly and its whole dependency tree.exclude
— excluding a module is actually excluding its whole dependency tree, overridinginclude
incase of a conflict.excludeShallow
— includes the module’s dependency tree, not including the module itself.
Having that, I do not see a clear way to accomplish what I want, can you help?