antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite
MIT License
1.27k stars 129 forks source link

build error when import ant-design-vue #355

Open bobby169 opened 1 year ago

bobby169 commented 1 year ago

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

Eacolt commented 1 year ago

I use NaiveUI and have the same problem as you, what can i do? so sad !

transtone commented 1 year ago

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

howiepu commented 9 months ago

same error.

Joffey commented 2 weeks ago

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.