Closed llamadeus closed 3 years ago
When I create a production build of my Next.js project, global ant design styles are not being applied on pages with no ant design components, even when I import antd/dist/antd.less directly within my _app.js file.
antd/dist/antd.less
_app.js
Reproducible setup:
/// package.json { "name": "my-app", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "antd": "^4.6.5", "babel-plugin-import": "^1.13.0", "next": "9.5.3", "next-plugin-antd-less": "^0.0.6", "react": "16.13.1", "react-dom": "16.13.1" } }
/// .babelrc { "presets": [ "next/babel" ], "plugins": [ [ "import", { "libraryName": "antd", "style": true } ] ] }
/// next.config.js const withAntdLess = require('next-plugin-antd-less'); module.exports = withAntdLess();
/// pages/_app.js import 'antd/dist/antd.less'; // This basically does nothing export default function MyApp({ Component, pageProps }) { return <Component {...pageProps} /> };
/// pages/index.js export default function Home() { return ( <div> <h1>Hallo Welt!</h1> </div> ); }
you can try current version 0.1.3, it's support.
When I create a production build of my Next.js project, global ant design styles are not being applied on pages with no ant design components, even when I import
antd/dist/antd.less
directly within my_app.js
file.Reproducible setup: