Closed johnstonphilip closed 7 months ago
Describe the bug When using Gutenberg Packages on the server side using node.js, when attempting to build, it throws this error:
ReferenceError: window is not defined
This appears to be due to the fact there's no window. Perhaps this should be reworked in case there is no window global set.
window
I am seeing this discussed here: https://dev.to/vvo/how-to-solve-window-is-not-defined-errors-in-react-and-next-js-5f97
It looks like @ellatrix already recently fixed a lot of these here: https://github.com/WordPress/gutenberg/pull/25332
I am still seeing one here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/blocks/src/api/raw-handling/ms-list-converter.js#L4
To reproduce Steps to reproduce the behavior:
Expected behavior Gutenberg packages can be used on the server side with node.js without any errors.
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/blob/src/index.js#L4
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/blocks/src/api/raw-handling/image-corrector.js#L9
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/blocks/src/api/raw-handling/paste-handler.js#L41
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/viewport/src/listener.js#L37
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/components/src/scroll-lock/index.js#L18
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/dom-ready/src/index.js#L33
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/a11y/src/index.js#L18
Another here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/components/src/focusable-iframe/index.js#L16
One more here:
https://github.com/WordPress/gutenberg/blob/658deef61912f10bc863e00b9111f41202f5c5d6/packages/blocks/src/store/process-block-type.js#L20
@johnstonphilip I think all or most top level ones have been fixed, so I'm going to close this issue because it's unclear what remains. If anything remains, could you open a new issue?
Describe the bug When using Gutenberg Packages on the server side using node.js, when attempting to build, it throws this error:
ReferenceError: window is not defined
This appears to be due to the fact there's no window. Perhaps this should be reworked in case there is no
window
global set.I am seeing this discussed here: https://dev.to/vvo/how-to-solve-window-is-not-defined-errors-in-react-and-next-js-5f97
It looks like @ellatrix already recently fixed a lot of these here: https://github.com/WordPress/gutenberg/pull/25332
I am still seeing one here: https://github.com/WordPress/gutenberg/blob/bd79ac4f2251c38519dd13e9090b0b8ee345498b/packages/blocks/src/api/raw-handling/ms-list-converter.js#L4
To reproduce Steps to reproduce the behavior:
Expected behavior Gutenberg packages can be used on the server side with node.js without any errors.