Skip to content

Commit b60ab22

Browse files
committed
fix: fixed for require function
1 parent f58fd37 commit b60ab22

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

babel-plugin-code-push/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const OPTIONS_TO_BUNDLE = [
1212
module.exports = function (babel, options) {
1313
const { types: t } = babel;
1414
const configPath =
15-
options.configPath ?? path.resolve(process.cwd(), "codepush.config.js");
15+
options.configPath != null
16+
? path.resolve(options.configPath)
17+
: path.resolve(process.cwd(), "codepush.config.js");
1618

1719
// Load config and imports from `codepush.config.js`
1820
const { config, configImports, importedIdentifiers } = loadConfig(configPath);
@@ -116,7 +118,9 @@ module.exports = function (babel, options) {
116118
let importDeclaration =
117119
convertRequireIntoImportStatement(declaration);
118120
imports.push(importDeclaration);
119-
importedIdentifiers.add(declaration.id.name); // Track the imported identifier
121+
declaration.id.properties.forEach((dec) => {
122+
importedIdentifiers.add(dec.value.name); // Track the imported identifier
123+
});
120124
}
121125
});
122126
}

0 commit comments

Comments
 (0)