Turbopack: Support import.meta.url in additional roots (#99511)
## Current State - In the runtime, `import.meta.url` tries to give you a real on-disk path if the file exists in the project filesystem and you're running in node. If you're running in the browser you get a fake `file:///ROOT/...` URL. - `__dirname` and `__filename` always give fake `/ROOT/...` paths This panics if `import.meta.url` exists in an additional root. ## Proposed Modification If `import.meta.url` exists in an additional root, just give a fake `file:///@rootName/...` URL. Common cases where you're reading a file relative to `import.meta.url` should still work, as those are handled by the analyzer. Externalized node modules should be unaffected because they don't call the Turbopack runtime for `import.meta.url`. --------- Co-authored-by:Claude <noreply@anthropic.com>
Showing
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
Please
register
or
sign in
to comment