refactor(env): move runtime env setup to packages#11039
Merged
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Contributor
|
Build Stats
|
Contributor
|
|
Smrtnyk
approved these changes
Jul 7, 2026
Collaborator
|
we should also at one point move jsdom dep to the node subpackage, i guess that comes later? |
Member
Author
I m following a plan step by step to avoid doing mess, but yes, the idea at the end is total separation for node and browser. As soon as i can do that 'fabric/node' is jut a re-export of @fabricjs/node, then i can move them. fabric package will still be requiring those, but it will be a legacy pacakge. if you install @fabricjs/browser in theory you won't have any node dep in your logs. |
Member
Author
|
Ok since you approved i move to next step right away. |
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.


Refactors Fabric environment setup so the core package owns only the environment holder, types, and setter/getter APIs, while the browser and node packages own their runtime-specific environment implementations.
The PR is small on purpose.
This PR is not moving core files yet and so imports from @fabric/node to src are still relative.
Key changes:
setEnvFactoryto the core env holder and remove browser/node runtime imports fromsrc/env.packages/browser/src/env.tsand install it lazily from browser/root browser entrypoints.NodeGLProbeintopackages/node/src, keeping@fabricjs/nodeandfabric/noderesponsible for jsdom/canvas.@fabricjs/corefrom a neutral core bundle so the published core package does not include runtime env implementations.Validation:
npm run lintpasses, with existing warnings.npm run prettier:checkis blocked locally by unrelated untrackede2e/report files; the PR files passoxfmt --check.tsc -p ./tsconfig.build.json --noEmittsc -p ./tsconfig-extensions.json --noEmittsc -p ./tsconfig.packages.json --noEmitnode ./scripts/package-smoke.mjsrg "jsdom|from 'canvas'|src/env/node|NodeGLProbe" packages/core src/envwindow/document