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

Fail to import packages in vite.config.ts when "type": "module" is set #1560

Closed
3 tasks done
sapphi-red opened this issue Jan 16, 2021 · 1 comment
Closed
3 tasks done

Comments

@sapphi-red
Copy link
Member

⚠️ 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

When { "type": "module" } is set in package.json and config is written in TypeScript, the error below occurs with vite & vite build.

failed to load config from /Users/green/Downloads/vite-project/vite.config.ts
error when starting dev server:
TypeError [ERR_INVALID_URL]: Invalid URL: vite
    at onParseError (internal/url.js:259:9)
    at new URL (internal/url.js:335:5)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:790:5)
    at Loader.resolve (internal/modules/esm/loader.js:86:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40)
    at link (internal/modules/esm/module_job.js:55:36)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Reproduction

  1. Run npm init @vitejs/app and select vue-ts.
  2. Add
  "type": "module"

to package.json.
3. Run npm run serve or npm run build.

System Info

  • vite version: 2.0.0-beta.30
  • Operating System: Windows 10
  • Node version: v14.15.4
  • Package manager (npm/yarn/pnpm) and version: npm 6.14.11
@CHOYSEN
Copy link
Contributor

CHOYSEN commented Jan 16, 2021

Seems like cause by 803f6da

@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