Skip to content

Commit

Permalink
fix: create custom babel plugin for package.json imports in src/ (#902
Browse files Browse the repository at this point in the history
)
  • Loading branch information
charliecruzan-stripe authored Apr 25, 2022
1 parent a9435df commit 97ee77e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
function ModifyPackageJsonImportForTranspilation() {
return {
visitor: {
ImportDeclaration(path) {
let importResource = path.node.source.value ?? '';
if (importResource.includes('../package.json')) {
importResource = '../' + importResource;
}
},
},
};
},
],
};

0 comments on commit 97ee77e

Please sign in to comment.