-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat!(msw-addon): fix package exports and generate esm build #138
Merged
yannbf
merged 1 commit into
mswjs:feat/support-msw-2.0
from
ChristianMurphy:feat/fix-types-and-generate-esm
Feb 21, 2024
Merged
feat!(msw-addon): fix package exports and generate esm build #138
yannbf
merged 1 commit into
mswjs:feat/support-msw-2.0
from
ChristianMurphy:feat/fix-types-and-generate-esm
Feb 21, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Closed
ChristianMurphy
force-pushed
the
feat/fix-types-and-generate-esm
branch
2 times, most recently
from
February 7, 2024 17:03
f282cc5
to
e48e0e5
Compare
this updates conditional exports so that both types and dependencies can be resolved. this also migrates build to generating esm by default for a more standards based packaging approach with strong support in modern tooling like webpack and vite. resolves mswjs#137
ChristianMurphy
force-pushed
the
feat/fix-types-and-generate-esm
branch
from
February 7, 2024 19:37
e48e0e5
to
b377470
Compare
ndelangen
approved these changes
Feb 19, 2024
Thanks a lot @ChristianMurphy! Let's update the beta and get feedback from the users with these changes |
yannbf
added a commit
that referenced
this pull request
Apr 17, 2024
* Breaking change: Support MSW 2.0 Co-authored-by: Gert Hengeveld <info@ghengeveld.nl> * update example to use MSW 2.0 handlers * temporarily disable tests in release workflow * update jest config to pass tests * fix path * worker * alias msw/native * update peer dependency range * upgrade example storybook * fix: use conditional exports (#134) * fix: use conditional exports * chore: keep "dist" as build directory * chore: remove custom webpackFinal config * chore: prevent browser-style resolution in jsdom tests * chore: remove old code * chore: use "index.ts" * fix: use environment-based tsconfig.json * chore: remove unused imports * fix: abstract "api.use()" to "applyRequestHandlers" * read getWorker export * add types for getWorker --------- Co-authored-by: Yann Braga <yannbf@gmail.com> * bring back tests * Filter requests that are not relevant to the user * make sure to reset the handlers * feat!(msw-addon): fix package exports and generate esm build (#138) this updates conditional exports so that both types and dependencies can be resolved. this also migrates build to generating esm by default for a more standards based packaging approach with strong support in modern tooling like webpack and vite. resolves #137 * fix(loader.ts): fix possible undefined (#141) If msw is running in fallback mode, navigator.serviceWorker may not be defined. * update auto * update to yarn 4 * upgrade chromatic * upgrade CI actions * fix return types * add yarn binary * fix jest script * fix chromatic script * fix chromatic script * update package.json files * refactor tsup config * remove unnecessary dependency * temp: downgrade to yarn1 * export applyRequestHandlers * update docs [skip ci] * update tests * upgrade to Storybook 8 * improve documentation on portable stories * deprecate mswDecorator * deprecate msw parameter as an array * migrate docs example to vite (#128) * migrate docs example to vite * migrate from jest to vitest * add rollup workaround * migrate example to Typescript --------- Co-authored-by: Gert Hengeveld <info@ghengeveld.nl> Co-authored-by: Matthew Costabile <mattcosta7@github.com> Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com> Co-authored-by: Christian Murphy <christian.murphy.42@gmail.com> Co-authored-by: Alex Muñoz <AlexMunoz@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this updates conditional exports so that both types and dependencies can be resolved.
this also migrates build to generating esm by default for a more standards based packaging approach with strong support in modern tooling like webpack and vite.
resolves #137
This draws from https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution-for-libraries
which recommends node16 resolution for libraries, which has the strictest resolution rules, which should work for almost all downstream adopters.
Follows similar ESM conventions to sindresorhus/meta#15
There are still a few quirks in legacy build tools (mostly webpack 4) https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c those generally should not impact storybook builds
📦 Published PR as canary version:
1.10.1--canary.138.7ca8425.0
✨ Test out this PR locally via:
npm install msw-storybook-addon@1.10.1--canary.138.7ca8425.0 # or yarn add msw-storybook-addon@1.10.1--canary.138.7ca8425.0