ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

Failed to resolve import "ant-design-vue/es/default/style/css.js" from "src/entry/main.js". Does the file exist?

Open wjf-richard opened this issue 1 year ago • 4 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.7.7

Environment

vue:2.7.0/vite:3.2.4/

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

pnpm run build

What is expected?

build sucess

What is actually happening?

error during build: Error: Failed to resolve import "ant-design-vue/es/default/style/css.js" from "src/entry/main.js". Does the file exist?

wjf-richard avatar Jan 12 '24 15:01 wjf-richard

need reproduce

cc-hearts avatar Jan 13 '24 02:01 cc-hearts

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Mar 14 '24 02:03 github-actions[bot]

same issue

checklittlelee avatar Mar 17 '24 15:03 checklittlelee

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar May 17 '24 02:05 github-actions[bot]

vue version: 3.4.21 This issue accured after I used unplugin-vue-components to load antd-vue components. My config is like this:

import Components from "unplugin-vue-components/vite"
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    Components({
      resolvers: [AntDesignVueResolver()],
      dts: true
    })
  ],
...

MattinaYang avatar May 23 '24 03:05 MattinaYang

Found the key! Just add importStyle: 'css-in-js' or 'less' to the resolver, it works:

resolvers: [
        AntDesignVueResolver({
          // importStyle: 'css-in-js'
          importStyle: 'less'
        })
      ]

MattinaYang avatar May 23 '24 04:05 MattinaYang

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jul 23 '24 02:07 github-actions[bot]