Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: create custom babel plugin for package.json imports in src/ #902

Merged

Conversation

charliecruzan-stripe
Copy link
Collaborator

Summary

babel plugin identifies import declarations that need to be modified for transpilation. right now, that's only the ../../package.json import

Motivation

fixes #841

Testing

run yarn prepare with these changes, and lib/commonjs/components/StripeProvider.js and lib/module/components/StripeProvider.js have the correct file path

@charliecruzan-stripe charliecruzan-stripe merged commit 97ee77e into master Apr 25, 2022
@charliecruzan-stripe charliecruzan-stripe deleted the charliecruzan-babel-plugin-for-pjson-import branch April 25, 2022 14:11
@byCedric
Copy link

Thx bae ❤️

@peterpme
Copy link

Thx baes ❤️

ImportDeclaration(path) {
let importResource = path.node.source.value ?? '';
if (importResource.includes('../package.json')) {
importResource = '../' + importResource;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm actually i think this isn't assign the new path to the actual path.node.source.value, will commit another fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error: Error: Unable to resolve module ../../package.json
3 participants