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
vitpress构建组件文档时报错(package.json文件中添加了"type": "module",):
import { ArrowDown, Search, ArrowRight } from "@nutui/icons-vue";
^^^^^^^^^
SyntaxError: Named export 'ArrowDown' not found. The requested module '@nutui/icons-vue' 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:
根据报错修改删除package.json文件中的"type": "module",
代码改成:import * as pkg from "@nutui/icons-vue"
const { ArrowDown } = pkg后编译报错:
(node:33253) 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)
/Users/jijianmei/jjm/work/projects/za-template/za-component/zat-h5-components/node_modules/.pnpm/@nutui+icons-vue@0.1.1/node_modules/@nutui/icons-vue/dist/es/index.es.js:2
export { config as IconFontConfig } from "./icons/IconFontConfig.js";
^^^^^^
SyntaxError: Unexpected token 'export'
vitpress构建组件文档时报错(package.json文件中添加了"type": "module",):
import { ArrowDown, Search, ArrowRight } from "@nutui/icons-vue";
^^^^^^^^^
SyntaxError: Named export 'ArrowDown' not found. The requested module '@nutui/icons-vue' 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 '@nutui/icons-vue';
const { ArrowDown, Search, ArrowRight } = pkg;
根据报错修改删除package.json文件中的"type": "module",
代码改成:import * as pkg from "@nutui/icons-vue"
const { ArrowDown } = pkg后编译报错:
(node:33253) 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)/Users/jijianmei/jjm/work/projects/za-template/za-component/zat-h5-components/node_modules/.pnpm/@nutui+icons-vue@0.1.1/node_modules/@nutui/icons-vue/dist/es/index.es.js:2
export { config as IconFontConfig } from "./icons/IconFontConfig.js";
^^^^^^
SyntaxError: Unexpected token 'export'
想问下这个nutui/icons-vue不是应该支持esmodule的方式么?应该如何修改?
PS:本地运行没有问题,版本号如下
"vite": "^4.5.0",
"vitepress": "1.0.0-rc.15",
"@nutui/icons-vue": "^0.1.1",
The text was updated successfully, but these errors were encountered: