Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Fix silent fail if @babel/plugin-proposal-decorators is in user's Bab…
Browse files Browse the repository at this point in the history
…el configuration (#237)

Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
  • Loading branch information
puku0x and ybiquitous authored May 3, 2022
1 parent 1a8e100 commit 9579653
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 7 deletions.
11 changes: 11 additions & 0 deletions extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ function loadBabelOpts(opts) {
}
}

// avoid conflicting with the legacy decorators plugin
if (opts.plugins && opts.plugins.some((p) => p.key === 'proposal-decorators')) {
const index = opts.parserOpts.plugins.findIndex(
(p) => Array.isArray(p) && p[0] === 'decorators',
);

if (index > -1) {
opts.parserOpts.plugins.splice(index, 1);
}
}

return opts;
}

Expand Down
219 changes: 212 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@babel/core": "^7.17.9"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.17.9",
"@stylelint/prettier-config": "^2.0.0",
"@stylelint/remark-preset": "^2.0.0",
"autoprefixer": "^9.8.6",
Expand Down
Loading

0 comments on commit 9579653

Please sign in to comment.