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

Preview error: Package subpath './bin/vite.js' is not defined by "exports" #1616

Closed
ilya-merkushin opened this issue Jul 21, 2022 · 0 comments

Comments

@ilya-merkushin
Copy link

Ubuntu 22.04, VSCode 1.69.2 Linux x64 5.15.0-41-generic snap, Volar ( Vue + TS plugin) v0.38.9, Vue3 + Vite 3.0.2

When I try to run Preview, I get an error in the Terminal window. Preview window does not work.

image
image

Error:

ilya@ilya:/media/ilya/data/Projects/nwl/nwl-web$ node "/home/ilya/.vscode/extensions/vue.volar-0.38.9-linux-x64/dist/preview-bin/vite.js" --port=3333node:internal/modules/cjs/loader:488
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/vite.js' is not defined by "exports" in /media/ilya/data/Projects/nwl/nwl-web/node_modules/vite/package.json
    at new NodeError (node:internal/errors:372:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:472:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:753:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at Object.<anonymous> (/home/ilya/.vscode/extensions/vue.volar-0.38.9-linux-x64/dist/preview-bin/vite.js:8:29)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
} 

vite.config.ts

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant