Closed danlobo closed 2 years ago
Replace broken package 'closest' with polyfill Fix webpack4 'window not an object' (https://stackoverflow.com/questions/55849240/window-is-not-defined-after-a-build-with-webpack)
yarn run pretty
'window is not an object' errors when using server-side.
Webpack 4 has issues with window object when the context doesn't have it. It works on browser, but not on server-side.
There are workarounds to not change the settings, but involves dynamic imports inside client-side methods (componentDidUpdate / useEffect ).
Custom classes in separated files, like nodes, factories and widgets doesn't work because imports aren't possible.
import
The package closest relies on Element object, which doesn't exist on server-side context.
closest
This fixes webpack4 issue as seen here.
The closestpackage was removed and replaced with a polyfill.
When will this be merged?
I think this was already fixed
Replace broken package 'closest' with polyfill Fix webpack4 'window not an object' (https://stackoverflow.com/questions/55849240/window-is-not-defined-after-a-build-with-webpack)
Checklist
yarn run pretty
What?
'window is not an object' errors when using server-side.
Why?
Webpack 4 has issues with window object when the context doesn't have it. It works on browser, but not on server-side.
There are workarounds to not change the settings, but involves dynamic imports inside client-side methods (componentDidUpdate / useEffect ).
Custom classes in separated files, like nodes, factories and widgets doesn't work because
import
s aren't possible.The package
closest
relies on Element object, which doesn't exist on server-side context.How?
This fixes webpack4 issue as seen here.
The
closest
package was removed and replaced with a polyfill.Feel good image: