-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Describe the bug
When we tried to upgrade from version 2.15.0 -> latest webcomponents-react package, we were hit with this issue during build execution of our NextJS pages router app.
I saw that on empty template project, it works with no issues, but the moment you add AnalyticalTable component, it starts to fail.
Error in the console during "npm run build" execution:
Generating static pages using 9 workers (0/3) [=== ]ReferenceError: document is not defined
at ignore-listed frames
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: document is not defined
at ignore-listed frames
Export encountered an error on /, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null
I suppose that there is a missing if-guard somewhere in AnalyticalTable which uses the browser 'document', that should not be executed during pre-rendering on the node environment. I hope it is an easy fix. And since it was working until now, after I saw the changelog, I guess its an error since 2.16.0 onwards.
For the moment this blocks us from actually upgrading the version until it gets fixed.
Isolated Example
no example, its straight forward and the stackblitz template is vite based)
Reproduction steps
- "npx degit UI5/webcomponents-react/templates/nextjs-pages#main my-project" to download your template for NextJS pages router project
- cd my-project
- npm i
- npm run build (observe how the build will finalize with no issues)
- Add small configured AnalyticalTable component in /pages/index.tsx (you can use some examples from your docs for dummy data AnalyticalTable that you know should work).
- re-run "npm run build"
- Observe how the build now fails with the described error.
Expected Behaviour
The build should finish successfully.
Screenshots or Videos
UI5 Web Components for React Version
2.18.1
UI5 Web Components Version
2.18.1
Browser
Chrome
Operating System
macOS
Additional Context
No response
Relevant log output
Generating static pages using 9 workers (0/3) [=== ]ReferenceError: document is not defined
at ignore-listed frames
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: document is not defined
at ignore-listed frames
Export encountered an error on /, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: nullOrganization
No response
Declaration
- I’m not disclosing any internal or sensitive information.