Hi. first of all thanks for the great plugin. It's allowed us to take an awful Meteor/CoffeeScript project (written by us years ago) and refactor it into something manageable. However, Meteor recently changed its build pipeline so that a tool called reify runs over the code replacing import statements with calls into the reify runtime before the source hits babel (and this plugin). So when this plugin outputs an import statement, it never gets translated.
I know this is not an issue with this project (feel free to close). But I'm wondering if you have any pointers. I made an example repo for the Meteor issue (that got no resolution). I'll cut-n-paste the README below.
babel-plugin-tcomb broken
The babel-plugin-tcomb Babel plugin does not function correctly with Meteor
core package ecmascript after version 0.6.1.
Setup
$ cd /path/to/app
$ meteor npm install
$ meteor
Background
We use flow, tcomb, and babel-plugin-tcomb for static and runtime
type-checking, respectively. In this example project, the echo function
in main.js should only be passed foo1 or foo2, as described by FooType
in FooType.js. The second call to echo passes an illegal argument, bar1
and we expect a tcomb generated TypeError.
Details
In this example project, the ecmascript packages is pinned to 0.6.1. Under
this version, the following code is generated for the FooType.js module.
module.export({
FooType: function () {
return FooType
}
});
var _t; module.import('tcomb', {
"default": function (v) { _t = v }
});
var FooType = _t.enums.of(['foo1', 'foo2'], 'FooType');
This code correctly exports tcomb's type checker for FooType and the misuse
of the echo function in main.js is correctly detected:
TypeError: [tcomb] Invalid value "bar1" supplied to foo: FooType (expected one of [
"foo1",
"foo2"
])
Updating the ecmascript package to version 0.6.2 creates the following code:
import _t from "tcomb";
var FooType = _t.enums.of(["foo1", "foo2"], "FooType");
Which causes a syntax error:
import _t from "tcomb";
^^^^^^
SyntaxError: Unexpected reserved word
at Object.exports.runInThisContext (vm.js:53:16)
Hi. first of all thanks for the great plugin. It's allowed us to take an awful Meteor/CoffeeScript project (written by us years ago) and refactor it into something manageable. However, Meteor recently changed its build pipeline so that a tool called reify runs over the code replacing import statements with calls into the reify runtime before the source hits babel (and this plugin). So when this plugin outputs an import statement, it never gets translated. I know this is not an issue with this project (feel free to close). But I'm wondering if you have any pointers. I made an example repo for the Meteor issue (that got no resolution). I'll cut-n-paste the README below.
babel-plugin-tcomb broken
The
babel-plugin-tcomb
Babel plugin does not function correctly with Meteor core packageecmascript
after version0.6.1
.Setup
Background
We use
flow
,tcomb
, andbabel-plugin-tcomb
for static and runtime type-checking, respectively. In this example project, theecho
function inmain.js
should only be passedfoo1
orfoo2
, as described byFooType
inFooType.js
. The second call toecho
passes an illegal argument,bar1
and we expect atcomb
generatedTypeError
.Details
In this example project, the
ecmascript
packages is pinned to0.6.1
. Under this version, the following code is generated for theFooType.js
module.This code correctly exports
tcomb
's type checker forFooType
and the misuse of theecho
function inmain.js
is correctly detected:Updating the
ecmascript
package to version0.6.2
creates the following code:Which causes a syntax error:
Adding
babel-plugin-transform-es2015-modules-commonjs
doesn't help:FooType
is not exported:Question
Is there a fix for this issue or are we stuck with ecmascript@=0.6.1 (and therefore release
1.4.2.7
)?Thanks,
Peter.