prismicio / prismic-dom

Set of helpers to manage Prismic data
https://prismic.io/docs/technologies/prismic-dom-technical-reference
44 stars 16 forks source link

Improve isomorphism #39

Open controversial opened 4 years ago

controversial commented 4 years ago

Updates webpack config to use "this" over "window" in generated files. This allows the generated files in dist to be usable in both browsers and Node.js.

Previously, some server-side environments could generate "window is not defined" errors as a result of requiring the dist files bundled with prismic-dom, since the webpack-generated dist files referenced window specifically, which is usually only defined in browser environments.