onebay / vite-plugin-imp

A vite plugin for import library component style automatic.
MIT License
231 stars 24 forks source link

ant-design's component "DatePicker" not working when use the plugin #13

Closed PerishCode closed 3 years ago

PerishCode commented 3 years ago

Describe the bug

Library : vite-plugin-imp Version : 2.0.9

To Reproduce

https://codesandbox.io/s/broken-smoke-1pk50

Expected behavior

There should be some response when I click on the date cell, but I got nothing.

Additional context

If I import antd.css globally like

import "antd/dist/antd.css"

then it doesn't matter whether I use the plugin or not, DataPicker works fine.

psaren commented 3 years ago

antd should be use like:

vitePluginImp({
  libList: [
    {
      libName: 'antd',
      style: (name) => `antd/es/${name}/style/css.js`
    }
  ]
})

https://codesandbox.io/s/objective-cloud-o02fh?file=/vite.config.ts

PerishCode commented 3 years ago

Thanks a lot , it works well. ^_^