1

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

2 Answers 2

2

Use StubModules in requirejs configuration:

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.