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

Updated the addon package's Babel configuration #127

Merged
merged 4 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions files/__addonLocation__/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
<% if (typescript) { %> "presets": [["@babel/preset-typescript"]],
<% } %> "plugins": [<% if (typescript) { %>
<% } %> "plugins": [
"@embroider/addon-dev/template-colocation-plugin",<% if (typescript) { %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I upstreamed the interpolation code from ember-codemod-v1-to-v2. The expected output can be seen in these tests:

["@babel/plugin-transform-typescript", { "allowDeclareFields": true }],<% } %>
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
Copy link
Contributor Author

@ijlee2 ijlee2 May 31, 2023

Choose a reason for hiding this comment

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

I tested { "version": "legacy" } with ember-container-query as well as 4 private addons. The tests for these addons passed.

"@babel/plugin-proposal-class-properties"
]
}
1 change: 0 additions & 1 deletion files/__addonLocation__/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<% if (typescript) { %>"@babel/preset-typescript": "^7.18.6"<% } else { %>"@babel/eslint-parser": "^7.19.1"<% } %>,
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.20.13",
"@babel/plugin-syntax-decorators": "^7.17.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To my knowledge, @babel/plugin-syntax-decorators is unused in a v2 addon and is not needed according to Babel.

Syntax only

It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use plugin-proposal-decorators to both parse and transform this syntax.

"@babel/runtime": "^7.17.0",
"@embroider/addon-dev": "^3.0.0",<% if (typescript) { %>
"@glint/core": "^1.0.2",
Expand Down