-
Notifications
You must be signed in to change notification settings - Fork 138
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 cadence-parser's esm package #2815
base: master
Are you sure you want to change the base?
Conversation
Thank you! Is there an easy way to verify that this setup allows usage of the package in various environments (e.g. browser, Node.JS, etc.)? |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #2815 +/- ##
==========================================
+ Coverage 79.23% 79.26% +0.03%
==========================================
Files 333 333
Lines 78753 78769 +16
==========================================
+ Hits 62401 62440 +39
+ Misses 14042 14025 -17
+ Partials 2310 2304 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@wfalcon0x could you please share code where you have issues with importing this package? cadence/npm-packages/cadence-parser/package.json Lines 10 to 19 in 54fe090
|
@nialexsan Running the following code from nodejs fails with a syntax error.
The error is:
The solution is to add a package.json into the /dist/esm folder with the following content:
|
@turbolent I tested it as follows: I first published the changes to my local npm repository, and then verified its functionality in the following scenarios:
Please note, the added dev dependency ([email protected]) requires { node: '>=18.3.0 || >=16.17.0' } |
@nialexsan Thank you for having a look! Could you please have another look at what wfalcon0x posted? |
@wfalcon0x Thank you again for your contribution and your patience! Could you please see if #2851 improved things for you? If yes, we can maybe close this PR. Alex provides some details on how this PR might not be the way we want to go here: #2851 (comment). Hope that makes sense (I don't know much about it), but please report back if you're still running into issues. Thanks! |
Description
cadence-parser's build configuration is using tsc to build a dual package, however, the created esm module cannot be imported from a nodejs es module, as the
"type": "module"
is missing from the es module specific package.json.This PR contains a way to solve this issue, although many other ways exist based on the choice of tooling. The solution included is an attempt to fix it with the smallest amount of change to the current toolings and configuration.
master
branchFiles changed
in the Github PR explorer