Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

@babel/preset-env@7.14.0 cannot be used with @glimmer/babel-preset #352

Open
chadhietala opened this issue May 24, 2021 · 0 comments
Open

Comments

@chadhietala
Copy link
Member

In 7.14.0 @babel/preset-env made private fields and methods part of the default plugins. When you attempt to use the glimmer preset in conjunction with babel-preset-env, you we get a error like the following:

If you are using ["@babel/plugin-proposal-decorators", { "legacy": true }], make sure it comes *before* "@babel/plugin-proposal-class-properties" and enable loose mode, like so:
	["@babel/plugin-proposal-decorators", { "legacy": true }]
	["@babel/plugin-proposal-class-properties", { "loose": true }]
  45 |   static template = hbs`
  46 |     <img width={{this.width}} height={{this.height}} data-delayed-url={{this.lazyUrl}} src={{this.url}} ...attributes />  `;
> 47 |   @service
     |   ^

Steps to reproduce:

  1. In this repo run yarn upgrade @babel/preset-env
  2. yarn start
  3. See the following error
ERROR in ./packages/example-apps/rehydration/src/MyComponent.ts
    Module build failed (from ./node_modules/babel-loader/lib/index.js):
    SyntaxError: /Users/chietala/Code/glimmer.js/packages/example-apps/rehydration/src/MyComponent.ts: Decorators are not enabled.
    If you are using ["@babel/plugin-proposal-decorators", { "legacy": true }], make sure it comes *before* "@babel/plugin-proposal-class-properties" and enable loose mode, like so:
    	["@babel/plugin-proposal-decorators", { "legacy": true }]
    	["@babel/plugin-proposal-class-properties", { "loose": true }]
       5 |
       6 | class MyComponent extends Component {
    >  7 |   @tracked count = 1;
         |   ^^^^^^^^^^^^^^^^^^^
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant