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

Add package.json#exports and fix peer dependencies #24

Merged
merged 9 commits into from
Sep 21, 2023

Conversation

donmccurdy
Copy link
Contributor

@donmccurdy donmccurdy commented Sep 20, 2023

Important change to package.json for each package here:

- "main": "dist/core.cjs",
- "module": "dist/core.js",
+ "main": "./dist/core.cjs",
+ "exports": {
+   "require": "./dist/core.cjs",
+   "default": "./dist/core.js"
+ },

module is ignored in Node.js contexts where Vite and Rollup run, so the previous ESM build was always ignored in favor of CJS. I'll publish this as a new major version, because adding exports is typically considered a breaking change.

Along with updating the peer dependencies, this avoids the dual-package-hazard problem where Vite could load a CJS copy of @gltf-transform/* for the plugin, an ESM copy for the user's transform operations, and the two wouldn't interoperate correctly.


To do:

  • fix the prerelease macros so we don't increment the version each time
  • test a prerelease

@donmccurdy donmccurdy marked this pull request as ready for review September 21, 2023 01:09
@donmccurdy donmccurdy merged commit 1ad030d into nytimes:main Sep 21, 2023
1 check passed
@donmccurdy donmccurdy deleted the fix/deps-3.x branch September 21, 2023 01:29
@donmccurdy donmccurdy mentioned this pull request Sep 21, 2023
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.

1 participant