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

ESM support #131

Closed
Heartnett opened this issue Sep 3, 2021 · 0 comments
Closed

ESM support #131

Heartnett opened this issue Sep 3, 2021 · 0 comments

Comments

@Heartnett
Copy link

Heartnett commented Sep 3, 2021

@antfu Thanks for this awesome project!

Currently v0.14.11 is causing this issue:

failed to load config from .....\vite.config.ts
error when starting dev server:
file:///...../node_modules/.pnpm/unplugin-vue-components@0.14.11_vite@2.5.3+vue@2.6.14/node_modules/unplugin-vue-components/dist/chunk-EDKGX5IJ.mjs:348
import { sync as resolve } from "resolve";
^^^^
SyntaxError: Named export 'sync' not found. The requested module 'resolve' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'resolve';
const { sync: resolve } = pkg;

at ModuleJob._instantiate (internal/modules/esm/module_job.js:121:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:166:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async loadConfigFromFile (.....\node_modules\.pnpm\vite@2.5.3\node_modules\vite\dist\node\chunks\dep-1be34a63.js:77045:31)
at async resolveConfig (.....\node_modules\.pnpm\vite@2.5.3\node_modules\vite\dist\node\chunks\dep-1be34a63.js:76656:28)
at async createServer (.....\node_modules\.pnpm\vite@2.5.3\node_modules\vite\dist\node\chunks\dep-1be34a63.js:75179:20)
at async CAC.<anonymous> (.....\node_modules\.pnpm\vite@2.5.3\node_modules\vite\dist\node\cli.js:14007:24)

 ERROR  Command failed with exit code 1.

I think this commit may be the cause: da8740b
https://github.com/antfu/unplugin-vue-components/blob/da8740bd800fe8f3e19e111826553b390a251cbd/src/core/utils.ts#L5

@antfu antfu closed this as completed Sep 5, 2021
antfu added a commit that referenced this issue Sep 5, 2021
ascott18 pushed a commit to ascott18/unplugin-vue-components that referenced this issue Mar 4, 2023
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

2 participants