Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support serverRoot with hmr serializer chunks (#1137)
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
- Loading branch information