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

Commit 9579653

Browse files
puku0xybiquitous
andauthored
Fix silent fail if @babel/plugin-proposal-decorators is in user's Babel configuration (#237)
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
1 parent 1a8e100 commit 9579653

File tree

4 files changed

+279
-7
lines changed

4 files changed

+279
-7
lines changed

extract.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ function loadBabelOpts(opts) {
159159
}
160160
}
161161

162+
// avoid conflicting with the legacy decorators plugin
163+
if (opts.plugins && opts.plugins.some((p) => p.key === 'proposal-decorators')) {
164+
const index = opts.parserOpts.plugins.findIndex(
165+
(p) => Array.isArray(p) && p[0] === 'decorators',
166+
);
167+
168+
if (index > -1) {
169+
opts.parserOpts.plugins.splice(index, 1);
170+
}
171+
}
172+
162173
return opts;
163174
}
164175

package-lock.json

Lines changed: 212 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@babel/core": "^7.17.9"
7676
},
7777
"devDependencies": {
78+
"@babel/plugin-proposal-decorators": "^7.17.9",
7879
"@stylelint/prettier-config": "^2.0.0",
7980
"@stylelint/remark-preset": "^2.0.0",
8081
"autoprefixer": "^9.8.6",

0 commit comments

Comments
 (0)