'how to split require.js project into multiple small bundles?
Currently we are bundling our backbone application into a single script.js file, using r.js (require.js optimizer)
Below is the build configuration file we are using for it
({
baseUrl: './',
mainConfigFile: 'require-config.js',
name: 'require-config',
out: 'scripts.js',
optimize: "uglify2",
optimizeCss: "standard",
removeCombined: true,
preserveLicenseComments: false,
include: "lib/require.min"
})
This makes script.js of 11.5 MB, which causes 45 - 60 seconds on the client side to download. So we need to create multiple small bundles for the application
Solutions I had tried to achieve this: Adding modules section in build configuration Adding modules section in require-config file Adding bundles section in require-config file
None of these solution gave the desired output, of breaking the application into multiple modules
Is there any better way to bundle javascript applications (which uses require.js) into multiple small modules
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
