Babel 7 and Meteor


#1

Babel 7 is almost ready for release, one of the things I’m looking forward is optional chaining, so you can do user?.name?.firstName. From what I can understand, there is no way for users to manually upgrade the Babel used by Meteor bundler to 7.0-beta? (I saw a package called meteor-babel, but I have no idea how that is supposed to be used… Any plans on when Meteor will be upgraded to support Babel 7 (even if it’s only in beta etc)?

Thanks!


What's next for Meteor in 1.7?
#2

can this not be used now by installing the plug-in and adding it in your .babelrc?


#3

Nope, unfortunately its plugin requires babel 7 as its dependency and they have no plans to support babel 6.

There’s been another discussion about this Add Babel plugin “syntax-optional-chaining”


#4

Looks like Meteor 1.6 supports Babel 7 beta. Did you have the chance to test it? https://github.com/meteor/meteor/pull/9090


#5

There was an attempt to introduce Babel 7 during the beta (hence the PR that @nicooprat is referencing), but it failed due to the breaking changes in Babel 7 (which would automatically break your Meteor app if you had any Babel 6 stuff installed) + it was Alfa stage at that point. I think we can start talking about this once Babel 7 is oficially out.


#6

looking forward to this as well because of the TypeScript + Babel integration possibilities


#7

Anyone else having difficulties getting Meteor 1.6.1 to work, due to migration issues to babel 7?

I’ve now spend a couple of hours, but feel like I’m starting to surrender and give up :frowning:


#8

We’ve got Babel 7 working with Meteor 1.6.2-beta.5 now. It was a struggle. Let me know your specific issue and we might be able to help.


#9

I think I’m having troubles understanding the new plugins.

For example; I used babel-plugin-transform-export-extensions so I can use statements like export * as actions from './redux/actions'.

As this specific plugin doesn’t seem to work with babel 7, I tried replacing it with:

[
    "@babel/plugin-syntax-export-namespace-from",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-syntax-export-default-from",
    "@babel/plugin-proposal-export-default-from",
]

But I keep getting errors like:

While building for web.browser:
imports/modules/layout/index.js:4:9: This experimental syntax requires
enabling the parser plugin: ‘exportNamespaceFrom’ (4:9)

I was also getting errors on rest operators, but that one I’ve been able to fix.

Duplicate declaration "rest"
11 | const Table = ({ columns, rows, …rest })

Rewriting the export * as ns from './file' statements do bring me passed that specific error. But It would be nice if I understood how the plugins work, to bring that specific support back.


#10

Oh my, has it already been 2 weeks ago since I had the trouble of migrating?

Well… I was able to get my meteor project running again. But now I’m still strugling with some babel syntax.

Apparently, my testrunner (ava) want’s modules to be prefixed with module. But meteor seems to crash on it. Does anyone of you have any idea if meteor is still doing something specific with the .babelrc file?

This is how ava requires it to be, otherwise it will throw: Couldn't find plugin "styled-jsx/babel" relative to directory

{
  "presets": ["@babel/preset-react"],
  "plugins": ["module:styled-jsx/babel"],
}

But, Meteor crashes on that, it wants to have it the old way:

{
  "presets": ["@babel/preset-react"],
  "plugins": ["styled-jsx/babel"],
}

Babel 7 plugins/modules + jest/ava