ef4 / prember

Prerender Ember apps with Fastboot at build time.
MIT License
195 stars 17 forks source link

Embroider + imported style results in ReferenceError: document is not defined #73

Closed evoactivity closed 2 years ago

evoactivity commented 2 years ago

I wasn't sure which repo this issue belonged to, I discovered it while adding prember to a new app.

If I add a css import to a ts/js file eg

application/route.ts

import '../style/styles.css';

Webpack attempts to use insertStyleElement to inject the css to the page, but this uses document.createElement so the page fails to render under fastboot and prember cannot successfully build the page https://github.com/webpack-contrib/style-loader/blob/43bede4415c5ccb4680d558725e0066f715aa175/src/runtime/insertStyleElement.js

style-loader in general makes use of document quite liberally. What would need to happen to support this?

ef4 commented 2 years ago

This is being worked on here

https://github.com/embroider-build/embroider/issues/1049

and here

https://github.com/embroider-build/embroider/pull/1146

evoactivity commented 2 years ago

Thanks @ef4 I'll close this issue