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

feat: update babel decorator config to latest #103

Merged
merged 6 commits into from
Apr 17, 2024
Merged

Conversation

3cp
Copy link
Member

@3cp 3cp commented Apr 17, 2024

au2 has adopted latest decorator spec.

closes aurelia/aurelia#1946, #102

@ivanbacher
Copy link
Contributor

I get this error when making changes

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /Users/ivan/Workspace/DLAB/Searobend/Repositories/searobend-client/src/main.js: The decorators plugin, when .version is '2018-09' or not specified, requires a 'decoratorsBeforeExport' option, whose value must be a boolean.

@ivanbacher
Copy link
Contributor

ivanbacher commented Apr 17, 2024

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "loose": true,
        "modules": false,
        "exclude": [
          "@babel/plugin-proposal-dynamic-import"
        ]
      }
    ]
  ],
  "plugins": [
    "@babel/plugin-transform-class-static-block",
    [
      "@babel/plugin-proposal-decorators",
      {
        "version": "2023-11"
      }
    ],
    [
      "@babel/plugin-transform-class-properties",
      {
        "loose": true
      }
    ],
    "@babel/plugin-syntax-dynamic-import"
  ]
}

I had to add @babel/plugin-transform-class-static-block to get it to work correctly. Also the decoratorsBeforeExport": true option in @babel/plugin-proposal-decorators did not really seem to do anything. Did not really matter if it was there or not.

@3cp
Copy link
Member Author

3cp commented Apr 17, 2024

transform-class-static-block, I assume you use static block in your code?

@ivanbacher
Copy link
Contributor

ivanbacher commented Apr 17, 2024

transform-class-static-block, I assume you use static block in your code?

Hmm, never mind about the transform-class-static-block. After applying changes from your latest commits it seems to be working without it 🤯.

Thanks for making these changes so quickly.

@3cp
Copy link
Member Author

3cp commented Apr 17, 2024

Not tested. I rely on CI for the validation :-)
TS is much easier to setup, since TS checks the typing of the decorator, it knows which version it uses.

@3cp 3cp marked this pull request as ready for review April 17, 2024 09:16
Copy link
Member

@bigopon bigopon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @3cp 👍 thanks!

@3cp 3cp merged commit 56d2814 into master Apr 17, 2024
22 checks passed
@3cp 3cp deleted the update-babel-decorator branch April 17, 2024 10:16
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

Successfully merging this pull request may close these issues.

2.0.0-beta.15 - using @inject is throwing errors
3 participants