KyleAMathews / cjsx-loader

coffee-react-transform loader module for webpack
53 stars 11 forks source link

ES6/Babel support #14

Closed TrySpace closed 8 years ago

TrySpace commented 8 years ago

Any plans on supporting es6/babel syntax, or conversion from ES6 to ES5?

KyleAMathews commented 8 years ago

Hi you want https://github.com/babel/babel-loader for this.

TrySpace commented 8 years ago

What I mean is if there is any plans to add babel-loader to this repo.

I'm struggling to add it myself, because simply adding "babel?presets[]=es2015" to the 'cjsx' loaders gives me the error that import is a reserved word, or it doesn't recognize #

KyleAMathews commented 8 years ago

You don't understand Webpack loaders correctly. Each Webpack loader (like this one) is meant to be used only with one type of file. cjsx-loader is designed to load/transform CJSX (JSX in Coffeescript) and that's it. Combining Babel and CJSX would be weird... try imagining a file with Coffeescript and Javascript intermingled.

Try googling for some tutorials on setting up Webpack loaders. They can be pretty confusing at first for sure.

TrySpace commented 8 years ago

Ok, so I found out the maintainer is coffeescript is very unwilling to adapt any es6 syntax. On the other hand, I found out there is similar Class definitions and a lot of other similarities, so I don't have to completely rewrite es6 code examples that much. Mainly the import is the most annoying, but there is https://www.npmjs.com/package/coffee-import, however, I can't get that to work with cjsx yet, not sure if it's the load order, or it would have to be combined probably.

TrySpace commented 8 years ago

Also, there was even a kickstarter for a potential coffeescript 2, called coffee-redux, but it has been inactive for almost a year now, and it seems that it's also dead: https://github.com/michaelficarra/CoffeeScriptRedux/issues/338

It's likely because of this coffeescript is dying, and hopefully will be replaced by a new language.

Perhaps Earl Grey Or something like PureScript Maybe BabelScript, I like the name, but it's a shell of an RFC proposal, so basically nothing at all... Or TacoScript But offcourse for the real pros there's always: DogeScript which is taking the world by storm.

Although they would all require rewriting existing code.