Skip to content

Commit 9dad408

Browse files
authored
feat: check react/preact for the use of plugin (#191)
Hey Kent, the idea is simple that we should use ifAnyDep check to decide if use babel-plugin-transform-inline-environment-variables, no?
1 parent 7fa2781 commit 9dad408

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/config/babelrc.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,13 @@ module.exports = () => ({
7474
{root: ['./src'], alias},
7575
]
7676
: null,
77-
[
78-
require.resolve('babel-plugin-transform-react-remove-prop-types'),
79-
isPreact ? {removeImport: true} : {mode: 'unsafe-wrap'},
80-
],
77+
ifAnyDep(
78+
['react', 'preact'],
79+
[
80+
require.resolve('babel-plugin-transform-react-remove-prop-types'),
81+
isPreact ? {removeImport: true} : {mode: 'unsafe-wrap'},
82+
],
83+
),
8184
isUMD
8285
? require.resolve('babel-plugin-transform-inline-environment-variables')
8386
: null,

0 commit comments

Comments
 (0)