-
Notifications
You must be signed in to change notification settings - Fork 24
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: export CJS version for browser #43
fix: export CJS version for browser #43
Conversation
🦋 Changeset detectedLatest commit: 1d4135d The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
@MichaelDeBoey explained to me that the ultimate issue here is when node is running in a jsdom env it attempts to load the browser export and therefore needs a CJS version as it doesn't fully support ESM yet. |
For a more in depth explanation on what Jest is doing: have a look at microsoft/accessibility-insights-web#5421 (comment) |
9ef5318
to
18ed5c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks like all the exports
entries match up to npm pack --dry-run
now. We may eventually want to align the fetch distributed package with the others, but that's a separate undertaking I think.
I think it's confusing how the others are currently building into dist/src
while also including unbuilt src
files in the package - so my vote would be to align everything to something like this in the published package:
dist/blob.cjs // built CJS version
dist/lib.cjs // built CJS version
src/blob.js // raw ESM source file
src/lib.js // raw ESM source file
Plus all .map
files and .d.ts
etc go in dist/
@jacob-ebey Do you think this deserves a prerelease we can test against before we do the stable? Or are we comfortable publishing the stable? Remix uses caret dependencies for these so folks may pick them up as soon as they're published. |
Yeah I would do that in a follow-up PR if wanted
Here |
@MichaelDeBoey Sorry I trimmed that for brevity. There would also be |
.changeset/afraid-coats-rescue.md
Outdated
"@remix-run/web-blob": patch | ||
"@remix-run/web-fetch": patch | ||
"@remix-run/web-file": patch | ||
"@remix-run/web-form-data": patch | ||
"@remix-run/web-stream": patch | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a minor since it's sort of adding a new feature in CJS files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with patch
as it not a real feature, but I can go with minor
if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok - yeah I think it could go either way since there's no userland code API changes. Going to update to minor
just to be safe since we're providing a new surface area for the bundler
Just like @SimonB did with uuidjs/uuid#616
This will remove the necessity of having all the packages in
transformIgnorePatterns
in remix-run/remix#7220 or having them inmoduleNameMapper
in remix-run/react-router#9895Closes #11
Closes remix-run/remix#3402