Meteor's package ecmascript depends on isobuild:compiler-plugin

I’m trying to add a ES2015 NPM package. If I add api.use('ecmascript'), I get the following error:

 => Errors while adding packages:             
While selecting package versions:
error: unknown package: isobuild:compiler-plugin
Required by: ecmascript 0.1.3-plugins.1

I also tried using ecmascript@=0.1.3-plugins.0 since meteor show --show-all ecmascript says that’s the first version.

I’m not sure what I am doing wrong. Is there any other way to add a NPM package written in ES6 to meteor?

1 Like

The ecmascript package depends on new functionality not available in the current release. However, if instead of doing:

meteor command

you do

meteor --release PLUGINS-PREVIEW@2 command

(so that’s for all the meteor commands you use in this project), you will be able to add the ecmascript package:

meteor --release PLUGINS-PREVIEW@2 add ecmascript

Edit: just noticed you’re writing a package. I’ve not tried this with ES6 yet, so I’m not sure whether you also need to do

meteor --release PLUGINS-PREVIEW@2 create --package mypackage

Thanks! Now it is working!

To be able to publish a package that uses ecmascript (or any other new packages), you should create a dummy project with the PLUGINS-PREVIEW@2 release and work on it as a local package within that. The reason for this is that the Meteor version in a plain package directory (not within an app) defaults to the system-level version.

Then to use that package in other apps, you’ll have to have updated those apps to to that Meteor release as well.