I've stumbled upon a crash trying to start a Nuxt 3-based project in a subdirectory of a Nuxt 2 project.
So the main Nuxt 2 project at /project/ and a Nuxt 3-based docs subdirectory at /project/docs. This crashes due to nuxt dependency from the root project getting picked up.
It seems the issue is in this code:
|
new URL("./", url), |
|
// If url is directory |
|
new URL(joinURL(url.pathname, "_index.js"), url), |
|
// TODO: Remove in next major version? |
|
new URL("node_modules", url) |
This _resolve function receives an id parameter with a nuxt value.
It creates url with the value of the current working directory so /project/docs.
Then new URL("./", url) actually resolves to the /project/ directory instead of /project/docs which seems very much not expected to me.
Try this in a browser:
new URL('./', 'file:///project/docs').href
"file:///project/"
(Same for the new URL("node_modules", url) line above which seems to be scheduled for removal at some point)
I've stumbled upon a crash trying to start a Nuxt 3-based project in a subdirectory of a Nuxt 2 project.
So the main Nuxt 2 project at
/project/and a Nuxt 3-baseddocssubdirectory at/project/docs. This crashes due tonuxtdependency from the root project getting picked up.It seems the issue is in this code:
mlly/src/resolve.ts
Lines 75 to 79 in 6327ad8
This
_resolvefunction receives anidparameter with anuxtvalue.It creates
urlwith the value of the current working directory so/project/docs.Then
new URL("./", url)actually resolves to the/project/directory instead of/project/docswhich seems very much not expected to me.Try this in a browser:
(Same for the
new URL("node_modules", url)line above which seems to be scheduled for removal at some point)