Probably pretty straightforward question, but still I haven't found any feasible solution so far. Currently I am able to run the server purely from coffee files and even Mocha tests are able to work with coffee files. However RequireJS is still looking for *.js files :/ I am not feeling good about transpiling just to satisfy RequireJS.
Probably easier way would to be use NodeJS extensions, but since it's deprecated, it's not a good way. I am thinking about some solution like this:
requirejs.config({
nodeRequire: require,
compilers: [
{
extensions: ['.coffee','.litcoffee','.coffee.md']
compiler: require('coffee-script').compile
}
]
})
It would simply look for the file with these extensions and when found, compile it. Otherwise keep default behavior. Sure, it means some performance issues when looking for these files, but since it's meant for development only, I don't see a big problem.
Unfortunately it's hard for me to understand how RequireJS works under the hood. Otherwise I would have tried to work out some solution like this.
Is there some other solution that I am missing ?
SOLVED
After all of this I have decided for quite opposite approach. Use the require
for the browser side too, so I don't need to change anything for server code.