vite-ssg icon indicating copy to clipboard operation
vite-ssg copied to clipboard

CommonJS modules can always be imported via the default export

Open khoannvbapjp opened this issue 1 year ago • 3 comments

Describe the bug

import Antd, { Button, Dropdown, Menu, MenuItem, Layout, LayoutContent, Spin, Tooltip, Tag, Divider, Empty, Pagination } from "ant-design-vue/es/index.js"; ^^^^^^ SyntaxError: Named export 'Button' not found. The requested module 'ant-design-vue/es/index.js' 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 'ant-design-vue/es/index.js'; const { Button, Dropdown, Menu, MenuItem, Layout, LayoutContent, Spin, Tooltip, Tag, Divider, Empty, Pagination } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.14.0

Reproduction

error

System Info

error

Used Package Manager

npm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

khoannvbapjp avatar Mar 15 '23 08:03 khoannvbapjp

Do you have any solutions to this problem

Jeffrey-mu avatar Apr 25 '23 02:04 Jeffrey-mu

我也遇到了类似的问题。

A-floweR-y avatar Apr 05 '24 08:04 A-floweR-y