-
Notifications
You must be signed in to change notification settings - Fork 613
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: support serverRoot with hmr serializer chunks #1137
fix: support serverRoot with hmr serializer chunks #1137
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1137 +/- ##
=======================================
Coverage 83.09% 83.09%
=======================================
Files 206 206
Lines 10549 10550 +1
Branches 2619 2620 +1
=======================================
+ Hits 8766 8767 +1
Misses 1783 1783
☔ View full report in Codecov by Sentry. |
@robhogan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
I'm keen to promote some of these Why not set |
Summary: We use unstable_serverRoot heavily in Expo to support monorepos and consistently have issues where saving a file will log an error in the console: ``` Error: Unable to resolve module ./app/index from /Users/evanbacon/Documents/GitHub/expo/.: None of these files exist: * ../../app/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) * ../../app/index/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) at ModuleResolver.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15) at DependencyGraph.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph.js:277:43) at /Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/transformHelpers.js:169:21 at Server._resolveRelativePath (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:1045:12) at Server.requestProcessor [as _processSourceMapRequest] (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:449:37) at Server._processRequest (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:396:7) ``` This is because the HMR `sourceMappingURL` is being calculated relative to the projectRoot instead of the serverRoot, but all files are being resolved relative to the serverRoot. Pull Request resolved: #1137 Test Plan: [rob] Before: {F1154753453} After: {F1154752435} Reviewed By: huntie Differential Revision: D51467903 Pulled By: robhogan fbshipit-source-id: a14ca98a9d95eb18d521b11592b2d251fc09f178
Summary: We use unstable_serverRoot heavily in Expo to support monorepos and consistently have issues where saving a file will log an error in the console: ``` Error: Unable to resolve module ./app/index from /Users/evanbacon/Documents/GitHub/expo/.: None of these files exist: * ../../app/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) * ../../app/index/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) at ModuleResolver.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15) at DependencyGraph.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph.js:277:43) at /Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/transformHelpers.js:169:21 at Server._resolveRelativePath (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:1045:12) at Server.requestProcessor [as _processSourceMapRequest] (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:449:37) at Server._processRequest (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:396:7) ``` This is because the HMR `sourceMappingURL` is being calculated relative to the projectRoot instead of the serverRoot, but all files are being resolved relative to the serverRoot. Pull Request resolved: #1137 Test Plan: [rob] Before: {F1154753453} After: {F1154752435} Reviewed By: huntie Differential Revision: D51467903 Pulled By: robhogan fbshipit-source-id: a14ca98a9d95eb18d521b11592b2d251fc09f178
Summary: We use unstable_serverRoot heavily in Expo to support monorepos and consistently have issues where saving a file will log an error in the console: ``` Error: Unable to resolve module ./app/index from /Users/evanbacon/Documents/GitHub/expo/.: None of these files exist: * ../../app/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) * ../../app/index/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css|.web.cjs|.cjs) at ModuleResolver.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:114:15) at DependencyGraph.resolveDependency (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/node-haste/DependencyGraph.js:277:43) at /Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/lib/transformHelpers.js:169:21 at Server._resolveRelativePath (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:1045:12) at Server.requestProcessor [as _processSourceMapRequest] (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:449:37) at Server._processRequest (/Users/evanbacon/Documents/GitHub/expo/node_modules/metro/src/Server.js:396:7) ``` This is because the HMR `sourceMappingURL` is being calculated relative to the projectRoot instead of the serverRoot, but all files are being resolved relative to the serverRoot. Pull Request resolved: #1137 Test Plan: [rob] Before: {F1154753453} After: {F1154752435} Reviewed By: huntie Differential Revision: D51467903 Pulled By: robhogan fbshipit-source-id: a14ca98a9d95eb18d521b11592b2d251fc09f178
Summary
We use unstable_serverRoot heavily in Expo to support monorepos and consistently have issues where saving a file will log an error in the console:
This is because the HMR
sourceMappingURL
is being calculated relative to the projectRoot instead of the serverRoot, but all files are being resolved relative to the serverRoot.