I am using requirejs with coffeescript and cs plugin. When I go to production I bundle all using r.js optimizer which uses coffeescript.js to complie my cs files into javascript and put it all in all.js

In runtime, there is no need to the 159K coffeescript files, how can I prevent r.js from pushing it into the bundle and save this huge file space

有帮助吗?

解决方案

Use StubModules in requirejs configuration:

    stubModules: ['cs','coffee-script']

其他提示

If you're using this plugin it seems this should just work as part of the build process.

If thats not the case, its easy to set up manually:

In your bundle script, run the coffee executable first to build the coffeescript files to js, and then run r.js on those javascript files to optimize them.

Then you can even delete the temp js files if you like and only keep your single bundled files.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top