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

running vite leads to an error message when type: module is set in package.json #1712

Closed
3 tasks done
Fuzzyma opened this issue Jan 25, 2021 · 1 comment
Closed
3 tasks done

Comments

@Fuzzyma
Copy link

Fuzzyma commented Jan 25, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

On windows 10, running vite leads to an error message when type: module is set in package.json. It complains about ERR_UNSUPPORTED_ESM_URL_SCHEME

Reproduction

  1. Have a win 10 machine
  2. Create a project with npm init @vitejs/app and choose vue or ts-vue.
  3. Edit package.json to use type:module
  4. npm run dev

System Info

  • vite version: 2 beta 48
  • Operating System: win 10
  • Node version: v15.6.0
  • Package manager (npm/yarn/pnpm) and version: npm v7.4.0

Logs (Optional if provided reproduction)

The error message I am getting:

$ npm run dev

> vite-project2@0.0.0 dev
> vite

failed to load config from C:/Repositories/test/vite-project2/vite.config.js
error when starting dev server:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs 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:329:5)
    at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:82
4:11)
    at Loader.resolve (node:internal/modules/esm/loader:86:40)
    at Loader.getModuleJob (node:internal/modules/esm/loader:230:28)
    at Loader.import (node:internal/modules/esm/loader:165:28)
    at importModuleDynamically (node:internal/modules/cjs/loader:1051:27)
    at exports.importModuleDynamicallyCallback (node:internal/process/esm_loader
:30:14)
    at eval (eval at loadConfigFromFile (C:\Repositories\test\vite-project2\node
_modules\vite\dist\node\chunks\dep-382a279c.js:47522:37), <anonymous>:1:21)
    at loadConfigFromFile (C:\Repositories\test\vite-project2\node_modules\vite\
dist\node\chunks\dep-382a279c.js:47522:37)
    at resolveConfig (C:\Repositories\test\vite-project2\node_modules\vite\dist\
node\chunks\dep-382a279c.js:47240:34)
@yyx990803
Copy link
Member

closed via 33d3cca

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants