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: esm/cjs exports #2101

Merged
merged 5 commits into from Feb 27, 2023
Merged

fix: esm/cjs exports #2101

merged 5 commits into from Feb 27, 2023

Conversation

joshuaellis
Copy link
Member

@joshuaellis joshuaellis commented Feb 25, 2023

Why

What

  • Changes how the types package is built to ensure it's using the same build setup as other packages to incl. main and module exports.

Checklist

  • Ready to be merged

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2023

🦋 Changeset detected

Latest commit: 40ac903

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-spring/types Patch
@react-spring/core Patch
@react-spring/animated Patch
@react-spring/parallax Patch
@react-spring/rafz Patch
react-spring Patch
@react-spring/shared Patch
@react-spring/konva Patch
@react-spring/native Patch
@react-spring/three Patch
@react-spring/web Patch
@react-spring/zdog Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Feb 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
react-spring ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 27, 2023 at 8:17AM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 25, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 40ac903:

Sandbox Source
Animating Auto Configuration
Card Configuration
Cards Stack Configuration
Chaining Transition and a Spring Configuration
CSS Gradients Configuration
CSS Keyframes Configuration
Async CSS variables Configuration
Draggable List Configuration
Exit Before Enter Configuration
Flip Card Configuration
Floating Button Configuration
Goo Blobs Configuration
Image Fade Configuration
List Reordering Configuration
MacOS Dock Configuration
Masonry Grid Configuration
Multistage Transitions Configuration
Noise Configuration
Notification Hub Configuration
Horizontal Parallax Configuration
Sticky Parallax Configuration
Vertical Parallax Configuration
Rocket decay Configuration
Basic Transition Configuration
Native Slide Configuration
mystifying-sanne-5mui29 Issue #2097

@github-actions
Copy link

github-actions bot commented Feb 25, 2023

Size Change: -3.29 kB (-5%) ✅

Total Size: 56.7 kB

Filename Size Change
packages/animated/dist/index.mjs 0 B -1.77 kB (removed) 🏆
packages/core/dist/index.js 11.6 kB -14 B (0%)
packages/core/dist/index.mjs 0 B -11.4 kB (removed) 🏆
packages/parallax/dist/index.mjs 0 B -1.7 kB (removed) 🏆
packages/rafz/dist/index.mjs 0 B -906 B (removed) 🏆
packages/react-spring/dist/index.mjs 0 B -52 B (removed) 🏆
packages/shared/dist/index.mjs 0 B -6.96 kB (removed) 🏆
packages/types/animated.d.ts 0 B -197 B (removed) 🏆
packages/types/animated.js 0 B -20 B (removed) 🏆
packages/types/index.d.ts 0 B -71 B (removed) 🏆
packages/types/index.js 0 B -20 B (removed) 🏆
packages/types/interpolation.d.ts 0 B -802 B (removed) 🏆
packages/types/interpolation.js 0 B -20 B (removed) 🏆
packages/types/util.d.ts 0 B -2.14 kB (removed) 🏆
targets/konva/dist/index.mjs 0 B -336 B (removed) 🏆
targets/native/dist/index.mjs 0 B -752 B (removed) 🏆
targets/three/dist/index.mjs 0 B -347 B (removed) 🏆
targets/web/dist/index.mjs 0 B -2.2 kB (removed) 🏆
targets/zdog/dist/index.mjs 0 B -308 B (removed) 🏆
packages/animated/dist/esm/index.js 1.77 kB +1.77 kB (new file) 🆕
packages/core/dist/esm/index.js 11.4 kB +11.4 kB (new file) 🆕
packages/parallax/dist/esm/index.js 1.7 kB +1.7 kB (new file) 🆕
packages/rafz/dist/esm/index.js 906 B +906 B (new file) 🆕
packages/react-spring/dist/esm/index.js 52 B +52 B (new file) 🆕
packages/shared/dist/esm/index.js 6.96 kB +6.96 kB (new file) 🆕
targets/konva/dist/esm/index.js 336 B +336 B (new file) 🆕
targets/native/dist/esm/index.js 752 B +752 B (new file) 🆕
targets/three/dist/esm/index.js 347 B +347 B (new file) 🆕
targets/web/dist/esm/index.js 2.2 kB +2.2 kB (new file) 🆕
targets/zdog/dist/esm/index.js 308 B +308 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
packages/animated/dist/index.js 2.08 kB
packages/parallax/dist/index.js 2 kB
packages/rafz/dist/index.js 1.14 kB
packages/react-spring/dist/index.js 321 B
packages/shared/dist/index.js 7.26 kB
packages/types/dist/esm/index.js 53 B
packages/types/dist/index.js 323 B
targets/konva/dist/index.js 612 B
targets/native/dist/index.js 864 B
targets/three/dist/index.js 679 B
targets/web/dist/index.js 2.42 kB
targets/zdog/dist/index.js 650 B

compressed-size-action

Revert "chore: add type module to packages"

This reverts commit 0075866.

chore: remove echo of version from script

fix: use tsup on types package and stop direct imports too
@joshuaellis joshuaellis changed the title chore: add type module to packages fix: esm/cjs exports Feb 27, 2023
@joshuaellis joshuaellis merged commit 958c2a4 into master Feb 27, 2023
@joshuaellis joshuaellis deleted the fix/esm-cjs branch February 27, 2023 12:52
@perrin4869
Copy link

@react-spring/web can't be imported by an mjs module anymore:

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1119:15)
    at Module._compile (node:internal/modules/cjs/loader:1155:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)

@joshuaellis
Copy link
Member Author

@react-spring/web can't be imported by an mjs module anymore:

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1119:15)
    at Module._compile (node:internal/modules/cjs/loader:1155:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24)

If you're having a problem, please look at opening an issue with a supplied reproduction. Thanks!

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.

[bug]: ESM failed to resolve with Webpack bug in @react-spring
2 participants