You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import naive from 'naive-ui'
enhanceApp({ app }) {
app.use(naive)
}
npm run docs:build
✓ building client server bundles...
(node:31512) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
build error:
C:\Users\A0\Documents\vitePress\node_modules\naive-ui\es\index.js:1
export { default, install } from './preset';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap. (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
Expected results (期望的结果)
build Success
Actual results (实际的结果)
build Error
Remarks (补充说明)
I created an issuse on 'vitepress' ,but the developer answered...
Consider creating an issue on naive-ui's repo instead. Their ESM is completely invalid. First,
the files must be of extension .mjs as they have not set type module in their package.json.
Second, each import must have extension specified.
The text was updated successfully, but these errors were encountered:
I think this is caused by import map. It point import statament to es entry however nodejs runtime doesn't recogonize it since it's not a package with module=true or a file mjs extensition.
TuSimple/naive-ui version (版本)
2.33.3
Vue version (Vue 版本)
3.2.39
Browser and its version (浏览器及其版本)
Chrome(105.0.5195.102)
System and its version (系统及其版本)
windows(Windows 10 19044.1645)
Node version (Node 版本)
16.14.2
Reappearance link (重现链接)
https://github.com/haohao809/vitepress-test.git
Reappearance steps (重现步骤)
vitepress (version 1.0.0-alpha.6)
import naive from 'naive-ui'
enhanceApp({ app }) {
app.use(naive)
}
npm run docs:build
✓ building client server bundles...
(node:31512) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
build error:
C:\Users\A0\Documents\vitePress\node_modules\naive-ui\es\index.js:1
export { default, install } from './preset';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap. (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
Expected results (期望的结果)
build Success
Actual results (实际的结果)
build Error
Remarks (补充说明)
I created an issuse on 'vitepress' ,but the developer answered...
Consider creating an issue on naive-ui's repo instead. Their ESM is completely invalid. First,
the files must be of extension .mjs as they have not set type module in their package.json.
Second, each import must have extension specified.
The text was updated successfully, but these errors were encountered: