Skip to content

Issue with highcharts, when we have CSS code applied explicitly/implicitly from the pages/_app.js file #32496

@ivan-stojanov

Description

@ivan-stojanov

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
chart-ok

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
chart-not-ok

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

Metadata

Metadata

Assignees

Labels

bugIssue was opened via the bug report template.please verify canaryPlease verify the issue with the latest canary branch.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions