-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
CS 2.0.1 new Babel transpilation option works well for CS files without other CS files dependencies. But I couldn't make it work when I have to import a CS file. I have to write the CS file I want to import just like transpilation is not working. For instance:
red.coffee
import './lib' # working
console.log "lib was imported"lib.coffee
# chalk = require 'chalk' # working
import chalk from 'chalk' # not working
console.log chalk.red('This is red.').babelrc
{ "presets": ["env"] }The result is (node 8.6.0):
$ coffee -t red.coffee
/home/laurent/nodejs/foo/lib.coffee:2
import chalk from 'chalk';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:588:28)
at Object.loadFile (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/register.js:17:19)
at Module.load (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/register.js:52:36)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/laurent/nodejs/foo/red.coffee:3:1)
at Module._compile (module.js:624:30)
at Object.CoffeeScript.run (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/index.js:61:23)
at compileScript (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/command.js:264:29)
at compilePath (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/command.js:219:14)
at Object.exports.run (/home/laurent/nodejs/foo/node_modules/coffeescript/lib/coffeescript/command.js:140:20)
at Object.<anonymous> (/usr/local/lib/node_modules/coffeescript/bin/coffee:15:45)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:607:3I also tried coffee -t --require babel-register red.coffee, without effect. Is there something I'm doing wrong?