fix!: Remove browser field from package.json#2255
Merged
ryansolid merged 2 commits intosolidjs:nextfrom Sep 23, 2024
Merged
Conversation
… worker export doesn't get mapped back to removeBrowserPackageJson BREAKING CHANGE: Jest was previously mentioned as the reason that wasn't removed, but Jest now supports package.json modules. That said, some other tooling might still not support esm exports.
🦋 Changeset detectedLatest commit: 06113db The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
ryansolid
added a commit
that referenced
this pull request
Sep 24, 2024
* update dom-expressions to include client-side API placeholders in web/dist/server.js * update dom-expressions version to temporary one from git for testing * update lock file * Add exports to solid-js/store's server build to match the client build, marking the additional export as not supported on the server side * update dom-expressions * fix!: Remove browser field from package.json (#2255) * fix!: Remove browser field from package.json of core packages so that worker export doesn't get mapped back to removeBrowserPackageJson BREAKING CHANGE: Jest was previously mentioned as the reason that wasn't removed, but Jest now supports package.json modules. That said, some other tooling might still not support esm exports. * Create rare-birds-train.md --------- Co-authored-by: Ryan Carniato <[email protected]> * better handling of exports client/server * Improve signal setter type for code completion of string literal unions. (#2297) * fix * fix test * Create shy-islands-talk.md --------- Co-authored-by: Ryan Carniato <[email protected]> * update TS to NodeNext --------- Co-authored-by: Joe Pea <[email protected]> Co-authored-by: Will Kelly <[email protected]> Co-authored-by: 狐狸 <[email protected]>
lilybw
pushed a commit
to lilybw/solid
that referenced
this pull request
Nov 12, 2025
* fix!: Remove browser field from package.json of core packages so that worker export doesn't get mapped back to removeBrowserPackageJson BREAKING CHANGE: Jest was previously mentioned as the reason that wasn't removed, but Jest now supports package.json modules. That said, some other tooling might still not support esm exports. * Create rare-birds-train.md --------- Co-authored-by: Ryan Carniato <[email protected]>
This file contains hidden or 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
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.
Remove browser field from package.json of core packages so that worker export doesn't get mapped back the browser field by Vite, Rollup, Webpack etc;
BREAKING CHANGE: Jest was previously mentioned as the reason that wasn't removed, but Jest now supports package.json modules. That said, some other tooling might still not support esm exports.
Summary
A couple of years ago, it was noted that rollup, vite, and webpack map the
workerexport condition back to the browser field, which broke solid in certain edge runtimes (cloudflare) due to the need to load the server build of solid instead of the browser field. (notably, esbuild does not follow that behavior) Issues were opened with the respective bundlers, but vite closed as expected, and rollup didn't respond at the time. The fix as noted was to remove the browser field from pacakge.json, but it was noted that would break Jest and other non esm envs, which didn't support exports, but now they (Jest) do. (And esm adoption has continue to increase)Full discussion of the issue here:
solidjs/solid-start#263
Recently, the cloudflare adapter for astro removed their esbuild step, which resulted in breaking the adapter for users of solid bringing this back to attention. Context here:
withastro/astro#13172
Jest however, now supports package.json exports:
https://jestjs.io/blog/2022/04/25/jest-28#packagejson-exports,
and allows configuring how the exports of a package.json are resolved:
https://jestjs.io/blog/2022/04/25/jest-28#packagejson-exports
How did you test this change?
Here is an example repo showing Jest working with solid, while I've remove the browser field in a patch:
https://github.com/wkelly17/Solid-Jest-repro
Besides Jest now working, this would fix workarounds for users of cloudflare + astro + solid, and I think for anyone trying to bundle for Cloudflare using anything other than esbuild (and maybe some other edge runtimes? uncertain).
The main question I'm not sure about is, are there any other common community packages besides Jest that would preclude from making this merge now that some upstream issues have solved?