Skip to content

Commit a9c93a4

Browse files
MatiPl01tjzel
andauthored
fix(Worklets): Normalize Windows paths in bundle mode module IDs (#9721)
On Windows, Metro resolves module paths with backslashes, but the worklets bundle-mode `createModuleIdFactory` compares them against POSIX-separated entry/dir constants, so the checks never match. The worklets entry then never gets its fixed `-2` module id, and bundling a worklets app crashes at runtime with `Requiring unknown module -2`. This normalizes the path separators before the comparisons, so worklets bundle mode works when bundling on Windows (it already worked on macOS/Linux/CI). --------- Co-authored-by: Tomasz Żelawski <40713406+tjzel@users.noreply.github.com>
1 parent 9c2e3b0 commit a9c93a4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/react-native-worklets/bundleMode

packages/react-native-worklets/bundleMode/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ function getBundleModeMetroConfig(/** @type {any} */ config) {
151151
function bundleModeCreateModuleIdFactory() {
152152
let nextId = 0;
153153
const idFileMap = new Map();
154-
return (/** @type {string} */ moduleName) => {
154+
return (/** @type {string} */ moduleNameRaw) => {
155+
const moduleName = moduleNameRaw.replace(/\\/g, '/');
155156
if (idFileMap.has(moduleName)) {
156157
return idFileMap.get(moduleName);
157158
}

0 commit comments

Comments
 (0)