Skip to content

Commit

Permalink
Merge pull request #1520 from embroider-build/use-transform
Browse files Browse the repository at this point in the history
use transform babel plugins instead of proposal
  • Loading branch information
mansona authored Jul 7, 2023
2 parents 67f82f3 + 2e4bdf8 commit 96f87d1
Show file tree
Hide file tree
Showing 9 changed files with 433 additions and 61 deletions.
2 changes: 1 addition & 1 deletion docs/porting-addons-to-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Now that we've separated the test-app and docs app concerns from the addon, we c
4. `yarn add @embroider/addon-shim`. This is the only dependency a v2 addon needs (in order to interoperate with ember-cli.
5. We're going to set up a default build pipeline for things like template colocation and decorator support. Install these dev dependencies:

`yarn add --dev @embroider/addon-dev rollup @rollup/plugin-babel @babel/core @babel/plugin-proposal-class-properties @babel/plugin-proposal-decorators`
`yarn add --dev @embroider/addon-dev rollup @rollup/plugin-babel @babel/core @babel/plugin-transform-class-properties @babel/plugin-proposal-decorators`

6. Grab the [example babel config](https://github.com/embroider-build/embroider/blob/main/packages/addon-dev/sample-babel.config.json) and save it as `addon/babel.config.json`
- If you addon requires template transforms in order to publish to a shareable format. Apply transforms using the `babel-plugin-ember-template-compilation`. View how to use this in the [example babel.config.js](https://github.com/embroider-build/embroider/blob/main/packages/addon-dev/sample-babel.config.js)
Expand Down
2 changes: 1 addition & 1 deletion packages/addon-dev/sample-babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ module.exports = {
},
],
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-class-properties',
],
};
2 changes: 1 addition & 1 deletion packages/addon-dev/sample-babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
"@babel/plugin-transform-class-properties"
]
}
2 changes: 1 addition & 1 deletion packages/macros/tests/babel/macro-condition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('macroCondition', function () {
babelConfig(version: number) {
let babelConfig = makeBabelConfig(version, config);
if (version === 7) {
babelConfig.plugins.push('@babel/plugin-proposal-class-properties');
babelConfig.plugins.push('@babel/plugin-transform-class-properties');
}
babelConfig.filename = filename;
return babelConfig;
Expand Down
Loading

0 comments on commit 96f87d1

Please sign in to comment.