Is the optimization by r.js compile all the required modules?
chenxeed opened this issue · 1 comments
As what I understand in native requirejs, how to optimize the javascript.
We have a script, called it main.js that require some libraries, for example jquery, lodash, my_module, etc.
When we use r.js to optimize the script, it will create a minified main.js
that includes all required libraries inside. It was done with uglify2 and can also generate sourcemaps.
I tried to run rake assets:precompile
in my rails, and it successfully generate the build file in folder public/assets
, but i don't see my main.js
contain the required libraries inside, which means it still have to load asynchronously to get the modules. I'm wondering if how requirejs-rails is actually as same as what I expected with native requirejs. Any comment will be greatly appreciated.
Ah nevermind, after I put my file into modules in the requirejs.yml, it works well! My main.js
contain all required scripts.