Skip to content
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

Plugin path resolve problem on Windows platform #718

Closed
lackneets opened this issue Dec 1, 2022 · 2 comments
Closed

Plugin path resolve problem on Windows platform #718

lackneets opened this issue Dec 1, 2022 · 2 comments

Comments

@lackneets
Copy link

Environment

Nuxi 3.0.0                                                                                                                                                                                 

RootDir: C:/Users/User/works/Web/frontend                                                                                                                                         
Nuxt project info:                                                                                                                                                                          

------------------------------
- Operating System: `Windows_NT`
- Node Version:     `v18.12.1`
- Nuxt Version:     `3.0.0`
- Nitro Version:    `1.0.0`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `modules`, `ssr`, `proxy`, `css`, `vite`
- Runtime Modules:  `@nuxtjs-alt/[email protected]`, `()`
- Build Modules:    `-`
------------------------------

Reproduction

See @nuxtjs-alt/proxy/src/module.ts

Describe the bug

Under Nuxt 3.0, Nitro will generate a script at .nuxt/dev/index.mjs before server up:

//...
import { toRouteMatcher, createRouter } from 'file://C:/Users/User/works/Web/frontend/node_modules/radix3/dist/index.mjs';
import _ROuXHMtK6R from 'C:/Users/User/works/Web/frontend/.nuxt/nitro-fetch.mjs';
import { createProxyServer } from 'file://C:/Users/User/works/Web/frontend/node_modules/@refactorjs/http-proxy/dist/index.mjs';
//...

Then node complains:

ERROR  [worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Additional context

In my openion

C:/foo/bar.js
/foo/bar

should both be corrected to:

file://C:/foo/bar.js
file:///foo/bar

Please check my workaround discussion here.

Logs

ERROR  [worker reload] [worker init] Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

  at new NodeError (node:internal/errors:387:5)
  at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1017:11)
  at defaultResolve (node:internal/modules/esm/resolve:1097:3)
  at nextResolve (node:internal/modules/esm/loader:163:28)
  at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
  at link (node:internal/modules/esm/module_job:75:36)
@lackneets lackneets changed the title plugin resolve Windows Platform Plugin path resolve problem on Windows Platform Dec 1, 2022
@lackneets lackneets changed the title Plugin path resolve problem on Windows Platform Plugin path resolve problem on Windows platform Dec 1, 2022
@akasection
Copy link

seems to be fixed here: #732

@manniL
Copy link
Contributor

manniL commented Dec 8, 2022

Thus, closing here ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants