This example Mimosa app shows how to configure Mimosa to build dynamic module require.js applications.
The app has 4 modules.
commonmodule containing common code
main1module that waits 5 seconds before dynamically requiring
main2module that waits 5 seconds before dynamically requiring
How to Install
npm install -g mimosa, version
1.0.0-rc.6or higher is needed.
git clone https://github.com/dbashford/MimosaDynamicRequire
mimosa watch -s
- Navigate to https://localhost:3000
Keep an eye on your browsers "Net" panel and watch require.js dynamically pull in each module as time passes.
Now, shut down the server.
mimosa watch -som
- Navigate to https://localhost:3000 when the build finishes.
Nothing changes from a UI perspective, but now the application has been r.js optimized into the 4 dynamic modules with no code duplication between those modules.