-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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(ssr): strip NULL_BYTE_PLACEHOLDER before import #9124
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ export async function ssrLoadModule( | |
urlStack: string[] = [], | ||
fixStacktrace?: boolean | ||
): Promise<SSRModule> { | ||
url = unwrapId(url).replace(NULL_BYTE_PLACEHOLDER, '\0') | ||
url = unwrapId(url) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the |
||
|
||
// when we instantiate multiple dependency modules in parallel, they may | ||
// point to shared modules. We need to avoid duplicate instantiation attempts | ||
|
@@ -137,7 +137,7 @@ async function instantiateModule( | |
if (dep[0] !== '.' && dep[0] !== '/') { | ||
return nodeImport(dep, mod.file!, resolveOptions) | ||
} | ||
dep = unwrapId(dep) | ||
dep = unwrapId(dep).replace(NULL_BYTE_PLACEHOLDER, '\0') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, this may be the only line needed to do the fix. And it isn't needed because we call |
||
if (!isCircular(dep) && !pendingImports.get(dep)?.some(isCircular)) { | ||
pendingDeps.push(dep) | ||
if (pendingDeps.length === 1) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is needed.
transformRequest
expects an unwrapped+\0
URL (we need a name for the two URL spaces, rollup URL and browser URL?). This may not be related to what #6390 tried to fix, but I think we should always calltransformRequest
with a rollup URL. Probably not in this PR, but for 3.1 it may be worth allowingtransformRequest
to accept an URL in any space and always call unwrap+removeImportQuery+use\0
(maybe we could have atoRollupURL()
helper that does this? Still unsure about naming).