Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant