unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue
https://www.npmjs.com/package/unplugin-vue-components
MIT License
3.66k stars 341 forks source link

feat(ant-design-vue): support `css-in-js` import style #703

Closed JohnsonHuang4396 closed 2 months ago

JohnsonHuang4396 commented 9 months ago

Description

Support Ant-Design Vue 4.x

Previously, AntDesignVueResolver could only import CSS files, but now supports the introduction of CSS inJS files

Linked Issues

Additional context

stackblitz[bot] commented 9 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

JohnsonHuang4396 commented 9 months ago

Found this is no need ToT

ycs77 commented 7 months ago

I upgraded to ant-design-vue v4 and had an error:

[vite]: Rollup failed to resolve import "ant-design-vue/es/config-provider/style/css" from "D:/src/App.vue?vue&type=
script&setup=true&lang.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

Now I using the less import style to fix it temporarily:

AntDesignVueResolver({
  importStyle: 'less',
}),

I think this PR could fix it, @JohnsonHuang4396 could you reopen it?

ycs77 commented 7 months ago

And now the ant-design-vue latest version is v4, could you set the importStyle default to CSSinJS?

JohnsonHuang4396 commented 7 months ago

I'm glad that this PR is helpful to you, but I think the CSSinJS option is exactly the same as the Less option, just with different name. But I can't figure out a better way, so I closed this PR. Maybe you could give me some clue?🧐

ycs77 commented 7 months ago

Thanks for the response. I think that although the functionality is the same, the option value still has meaning to the user. Just like for package users "less" and "CSSinJS" are different. 🤔