Updating Babel version used by Meteor?

I use Flow annotations in my code, and recently they added the type import shorthand enabling you to do this:

import { func, type funcT } from 'func';

This type funcT needs to be stripped by Babel, and Babel added that in 6.22.0. When I run my own Babel against the file, it works perfectly, but Meteor complains that it cannot understand this syntax (because it is bundling an older Babel).

Is there a way of user-upgrading the version of Babel, or will there soon be another Meteor point-release with an updated version?

thank you

Per History.md in release-1.4.3, Meteor 1.4.3 will be shipped with Babel 6.22.1. You can try rcs of 1.4.3 for now.

2 Likes

While I’d encourage you to try the 1.4.3-rc.3 release candidate to help us test it, you should be able to simply run:

meteor add ecmascript@0.6.2-rc.3

…On your existing project to get the newer version of babel-core (provided by the meteor-babel NPM package internally).

2 Likes

Thank you for very quick responses. However, it doesn’t seem to work. I tried both adding ecmascript, as well as upgrading to the latest rc. Here is a commit diff to show the result of upgrading.

After upgrading, I did both meteor reset and meteor npm install, but it still gives me errors for

  • type import shorthand (import { x, typeof y } from 'x')
  • leading pipe in type declaration (type X = | string | number)
  • leading ampersand in type declaration (type X = & Store & { name: string })

All things that work in the latest Babel version.

Meteor doesn’t just enable every Babel transformation – have you installed the appropriate Babel plugin? For example…

https://www.npmjs.com/package/babel-plugin-transform-flow-strip-types

1 Like

I thought this was included with the react preset - it has been stripping my flow annotations until now without problem. But I can try explicitly adding these packages to babelrc.

Sent using OWA for iPhone