style is broken on build but works on dev env
See original GitHub issueHi there I’m trying to use this plugin in my project I’m using
1. "next": "^10.0.5"
2. "antd": "^4.16.0"
3. "next-plugin-antd-less": "^1.8.0"
4. "less": "^4.1.2"
and here is my next config file
const withPlugins = require("next-compose-plugins");
const { getThemeVariables } = require("antd/dist/theme");
const lessToJS = require("less-vars-to-js");
const fs = require("fs");
const path = require("path");
// antd custom variables
const themeVariables = lessToJS(
fs.readFileSync(
path.resolve(__dirname, "./styles/antd-variables.less"),
"utf8"
)
);
const antdLessConfig = {
modifyVars: {
...getThemeVariables({
dark: true, // Enable dark mode
}),
...themeVariables,
},
webpack(config) {
return config;
},
};
module.exports = withPlugins([[withAntdLess, antdLessConfig]]);
Everything is working fine on running yarn dev
but on run yarn build then yarn start I found the style is broken
all the styles i added is not used
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Styles broken in CRA Production Build but work fine ... - GitHub
My CRA-based PWA application with emotion styles works perfectly during development yarn start, however when built for production yarn build ...
Read more >The css style is not the same in development environment and ...
I think this is a problem of order of CSS definition. The development and production CSS definition order might be different.
Read more >Compiled CSS doesn't work as it should in production
Hi all, I just ran into this same issue. Everything works fine on development. When I run yarn build assets are compiled and...
Read more >Troubleshooting Common Errors - Gatsby
Inconsistent CSS styles between develop and build using styled-components or ... However, when your packaged Gatsby code runs, your computer is but a ......
Read more >Known issues with Android Studio and Android Gradle Plugin
To fix the issue for the current project, click Run > Edit Configurations and change the default JUnit configuration to only include the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@NickBeukema hi, you just change _app.tsx
import "./global.less"torequire('./global.less');can be fixed this problem. ref. https://github.com/SolidZORO/next-plugin-antd-less#how-to-import-global-less-style-eg-styleslessI just know it works but I don’t know why.
Hi @SolidZORO, I’m having a similar issue with
When I run
next devthe styles are looking fine but when building the project it seems like antd components with custom css style have the original antd style without the class I’ve created.Would love your help here 😃 Thanks,