質問

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