vite-ssg
vite-ssg copied to clipboard
build error when import ant-design-vue
Describe the bug
I use the vitesse template to test vite-ssg.
add ant-design-vue and run scripts npm run dev no error, but error when run npm run build .
import { Button } 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';
Reproduction
https://github.com/bobby169/vitesse
System Info
System:
OS: macOS 12.6.2
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 124.25 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.14.2 - /usr/local/bin/node
npm: 9.5.1 - /usr/local/bin/npm
Browsers:
Chrome: 114.0.5735.133
Safari: 15.6.1
Used Package Manager
pnpm
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.
I use NaiveUI and have the same problem as you, what can i do? so sad !
same error.
nuxt build no problem. but nuxt can't use keepalive with include.
nuxt add <RouteProvider> as <Keepalive> 's children in each page, so can't use page name to diff them.
https://github.com/nuxt/nuxt/issues/15214
same error.
same error, is there any solution? It seems that ant-design-vue/es/index.js is a ES Module, I can't figure it out why this happened.