Enable new javascript features with babel in meteor projects

Hi, is there a way to enable new Javascript in meteor Projects or to explicitly use a babelrc file to enable new stuff in js?

Thanks for the link, actually I’m more interested in stuff which came after ecmascript2015.
And second I would like to use babeljs if thats possible to customly use what babeljs is capable of.
e.g. class decorators → @babel/plugin-proposal-decorators · Babel

Does anyone know something except the documented stuff from meteor?

Thanks

2 Likes

Yes .babelrc files work with Meteor and will be merged with the default config.

The best docs are on the babel-compiler package itself: meteor/packages/babel-compiler at master · meteor/meteor · GitHub

Specifically:

For example, to enable the Babel transform that supports class properties, you should

  1. run meteor npm install --save-dev babel-plugin-transform-class-properties
  2. put the following in a .babelrc file in the root of your project:

{ “plugins”: [“transform-class-properties”] }

So you can totally install the decorators plugin and use it

1 Like