jp-coffeescript icon indicating copy to clipboard operation
jp-coffeescript copied to clipboard

Add option to use Babel

Open danielbayley opened this issue 7 years ago • 5 comments

Also uses the new --transpile option with babel-preset-env. Closes #11.

danielbayley avatar Oct 14 '17 10:10 danielbayley

Note to myself: [email protected] requires node@>=6.

n-riesco avatar Oct 18 '17 16:10 n-riesco

@danielbayley Thank you for your contribution. I've been testing it and I'm planning to merge it as soon as I decide how to address the following issues with [email protected]:

  • [email protected] doesn't transpile import statements.

  • babel transpilation of import statements would make them scoped to a cell (see https://github.com/n-riesco/jp-babel/issues/11 )

  • if I decide to use babel, then the modules babel-* should be listed as normal dependencies (they wouldn't be optional).

I'm also planning to enable Travis on this repository to catch compatibility issues with different Node versions.


One question, what's the purpose of this line?

n-riesco avatar Oct 19 '17 15:10 n-riesco

@n-riesco Sure, CS will always pass imports on, in this case to babel-preset-env…

I'm not sure what to suggest about the cell scoping, maybe a modified version of babel-plugin-transform-es2015-modules-commonjs or something? I wanted this for the Hydrogen Atom package, where I usually run-all, so hadn't actually noticed that issue.

One question, what's the purpose of [filename: __filename]?

That is so that Babel will always use the config from this package (and find the env plugin dependency), without the current working directory interfering with it. Does that make sense?

I will leave Allow edits from maintainers checked so you can tweak it however you like.

danielbayley avatar Oct 19 '17 20:10 danielbayley

@n-riesco, has there been any decision on these issues? Coffeescript 2.0 features are very useful. I've been using this branch for several months, and the only issue I've encountered is that I need to execute require 'babel-polyfill' before using async functions.

zach-capalbo avatar Jul 12 '18 14:07 zach-capalbo

@zach-capalbo If I remember correctly, the main issue with this PR is that import doesn't work.

n-riesco avatar Jul 12 '18 14:07 n-riesco