fix: attempt to fix module consumption for ESM, TS+ESM, CJS and TS+CJS#12
fix: attempt to fix module consumption for ESM, TS+ESM, CJS and TS+CJS#120gust1 wants to merge 7 commits intorcsb:masterfrom
Conversation
|
|
@bioinsilico I reworked the files to have a more readable diff in this PR. (it introduced "noisy" commits, which I can fixup later in a rebase, if needed) |
|
@0gust1 Thank you so much for this contribution. I will test the PR with the applications using the API tools and come back to you. As a scientific software developer, completely biased towards Scientific, it is always a nightmare to understand and deal with all these technical issues. |
|
I'm glad to help!
|
|
@bioinsilico FYI, I also have a local branch where I auto updated the project's dependencies ( I didn't pushed the resulting |
|
Thank you again for all your help, @0gust1. I have published a dev version (5.2.0-dev-js-pr12.1) in the npm registry. Our packages using this release only needed minor adjustments. Could you test it before merging and publishing as the latest release? |
out of curiosity, which kind of adjustments ?
Damn. It weirdly doesn't work. I still have the same module resolution error Why weird ? what I diduse the local
|
Leads and investigation (draft/pending)The published package tarball seems to lack something that the local version have (despite the code being the same, in principle)... but I don't see any hypothesis 1there is maybe a gotcha: https://docs.npmjs.com/cli/v11/using-npm/developers#keeping-files-out-of-your-package hypothesis 2 (ongoing)I'll try to locally package a tarball and use it directly (instead of |
|
I haven’t had the time to really dig into this yet, and honestly, I’m a bit lost.
To publish the package first I run buildApp and then publishApp I will do some testing with the setup that you provided me and see if I can find something useful. |
|
I haven't forgot :) |
|
Haha, you've already done too much. I am also busy with another project and haven't found the time to delve into this issue. |



closes #11
tsconfigfiles may also now be a bit clearer/smaller.Package.json fields:
main: default entry point when using commonJS. Fallback entry point for older Node.js environments or tools that don't support ES modules (backward compat)module: default entry point for ES modulesexports: Modern way to define package entry points with conditional exports. Overridesmainandmodulein compatible environments..- The main entry point when someone imports the packageimport- Used for ES modules (import statements)require- Used for CommonJS (require() calls)types- TypeScript definitions for this export./lib/*and./build/*- Allow deep imports like@rcsb/rcsb-api-tools/lib/somethingfiles: specifies which files/directories to include when publishing to npmThe result may deviate a bit from what was written in the changelog of the 5.0.0 version (e.g. generated types are exposed from both
lib/andbuild/, which may be clearer from the viewpoint of a consumer (IMHO)).