MimosaDynamicRequire
This example Mimosa app shows how to configure Mimosa to build dynamic module require.js applications.
The app has 4 modules.
- A
common
module containing common code - A
main1
module that waits 5 seconds before dynamically requiringmain2
- A
main2
module that waits 5 seconds before dynamically requiringmain3
- A
main3
module.
How to Install
npm install -g mimosa
, version1.0.0-rc.6
or higher is needed.git clone https://github.com/dbashford/MimosaDynamicRequire
cd 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.