Antd styles not working
See original GitHub issueI am trying to install antd into this boilerplate. The components are working fine but the styles are not applied. I tried following their guide installing
yarn add babel-plugin-import
and then
yarn
then i edited my .babelrc:
"plugins": [
"add-module-exports",
[
"import",
{
"libraryName": "antd",
"libraryDirectory": "es",
"style": "css"
}
]
],
but still, the styles do not apply. If I inspect the html i can see the classes applied to the button but no styles related to those classes. I tried importing the styles in every way and the only way i could make it work was adding this in the head of app.html, just below the title:
<script type="style/css" src="../node_modules/antd/dist/antd.css">
but it was only working in dev, when i package my application it obviously does not work. I couldn’t find any information on how to make styles work, any idea?
To reproduce the situation just clone this repo, and try make antd work. If you succeed doing that please share your work
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)

Top Related StackOverflow Question
What I supposed to do? I installed
antdpackage and import on app.global.css:@import '~antd/dist/antd.css';I made some changes on Home component to use a simple Button from antd and then run script
package-win.The
cssseems to work but the fonts are broken. See this imageI solved by modifying webpack.config.render.dev/prod.js