-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
"ReferenceError: document is not defined" when using require() from html file #461
Comments
Do not use |
@evilebottnawi Combination of css-loader and style-loader does also not work. But you are still right in your remark concerning the build target. I updated my issue description and linked to your comment. |
The error
Your problem is not same |
@evilebottnawi Ok, i understand your question. So till now we had a line like |
Can you clarify what do you want? If you need extract styles, please use https://github.com/webpack-contrib/mini-css-extract-plugin. The |
Ah ok. Yeah of course require-->node! Thank you so much. Really had a blind spot there. |
@flipcc could you please explain this comment "require-->node!" I am having a similar issue with my webpack implementation. |
With 'blind spot' or 'require--->node' I am referring to the fact, that I wrote Of course there is a new version of Node.js that supports import/ES Modules, but it is not a LTS version. Hope this helps. |
For me, the error was that I am using "style-loader" in webpack.server.config.js. which is wrong. |
I got this error when using this beside https://www.npmjs.com/package/mini-css-extract-plugin |
**Edit: Changed config to browser target in response to this comment. Problem persists.
Expected Behavior
Require the css file from index.html and have webpack -> file-loader -> style-loader inject it into a link tag in the head (see webpack.config.js). Same as when I import the file from index.js.
Actual Behavior
An error is thrown stating that no link tag can be added as document is not defined.
Code
How Do We Reproduce?
The stated files include everything needed to reproduce the issue raised.
The text was updated successfully, but these errors were encountered: