-
Notifications
You must be signed in to change notification settings - Fork 30k
Description
What version of Next.js are you using?
12.0.7 and 12.0.8-canary.5
What version of Node.js are you using?
16.13.0
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next build && next start
Describe the Bug
When using the Next v12.0.7 in combination with "highcharts": "^9.3.2" and "highcharts-react-official": "^3.1.0", in case we want to apply custom styles on the highcharts (with styledMode: true), there is an issue.
The issue is present, only in case we load any CSS code, on app loading. For example: in _app.js, wrap the components under the Layout component and then inside of Layout component, import the Layout.module.css file and apply any class. In case we have any styling applied (in Layout.module.css), after building the project, the overall UI is broken.
During the development, everything works as expected and is not reproducible.
If I downgrade the very same project to Next v11.1, the issue is not present, so this is why I believe the issue is on Next side and not on Highcharts side.
Expected Behavior
We should be able to add CSS code in the components that are loaded via _app.js and this code should not have any impact to the higcharts.
To Reproduce
Get the attached sample project and first run:
npm install
it works well if we use:
npm run dev
and if we visit http://localhost:8082 we will see how it should look like

if we then run
npm run build
npm run start
and if we visit http://localhost:8083 (simulation of the server) we will see how it should look like

here is what us causing it:
if we go at components\Layout.module.css and comment
.delux {
/*margin: 2px;*/
}
and if we rebuild
npm run build
npm run start
then this will work
This was just a dummy example. To summarize, the issue is reproducible whenever we are directly or indirectly including any CSS code, on page load (via _app.js probably, since the scoped CSS in the components that are not directly loaded from _app.js are not causing the issue).
The current solution is:
- downgrade to Next v11.1