Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
evoactivity opened this issue Feb 28, 2022 · 2 comments

Comments

@evoactivity
Copy link

evoactivity commented Feb 28, 2022

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
Copy link
Owner

ef4 commented Feb 28, 2022

This is being worked on here

embroider-build/embroider#1049

and here

embroider-build/embroider#1146

@evoactivity
Copy link
Author

Thanks @ef4 I'll close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants