We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
astro
2.0.17
none
pnpm
windows
chrome
add React UI library ant-design, but have no css style
the git is https://gitee.com/limao-xs/lm-astro-basics
because have the question(https://hub.nuaa.cf/vitejs/vite/issues/11064), I rewrite the defineConfig
defineConfig
export default defineConfig({ integrations: [react()], // <<<<<<<<<<<<<<<<<<<<<<<<< m_sp m vite: { resolve: { alias: { "antd/dist/reset.css": path.join( __dirname, "node_modules/antd/dist/reset.css" ), antd: path.join(__dirname, "node_modules/antd/dist/antd.js"), }, }, }, );
but how to import the antd/dist/reset.css?
antd/dist/reset.css
now:
expectation:
https://gitee.com/limao-xs/lm-astro-basics
The text was updated successfully, but these errors were encountered:
Please provide a small reproduction via astro.new and we can take a look. Thank you!
astro.new
Sorry, something went wrong.
Ant Design components are built with a CSS-in-JS solution, so they need JS running on the client to have any styles.
Astro requires you to opt-in to client-side JS with the client:load directive.
Add that to your React component and it should have styles applied.
Ant Design components are built with a CSS-in-JS solution, so they need JS running on the client to have any styles. Astro requires you to opt-in to client-side JS with the client:load directive. Add that to your React component and it should have styles applied.
Thanks! It works. Now I'm having an common and annoying behavior: the ant design flash 💥 This happens using NextJS too.
There is a workaround on Next. I'll try something similar
No branches or pull requests
What version of
astro
are you using?2.0.17
Are you using an SSR adapter? If so, which one?
none
What package manager are you using?
pnpm
What operating system are you using?
windows
What browser are you using?
chrome
Describe the Bug
add React UI library ant-design, but have no css style
the git is https://gitee.com/limao-xs/lm-astro-basics
because have the question(https://hub.nuaa.cf/vitejs/vite/issues/11064), I rewrite the
defineConfig
but how to import the
antd/dist/reset.css
?now:
expectation:
Link to Minimal Reproducible Example
https://gitee.com/limao-xs/lm-astro-basics
Participation
The text was updated successfully, but these errors were encountered: