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

build error when import ant-design-vue

Open bobby169 opened this issue 2 years ago • 4 comments

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.

bobby169 avatar Jun 24 '23 11:06 bobby169

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

Eacolt avatar Jun 29 '23 02:06 Eacolt

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

transtone avatar Jul 02 '23 16:07 transtone

same error.

howiepu avatar Oct 12 '23 09:10 howiepu

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.

Joffey avatar Jun 18 '24 14:06 Joffey