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

"no window.document found, will not HMR CSS" when emit=false #943

Closed
ntucker opened this issue May 17, 2022 · 8 comments · Fixed by #953
Closed

"no window.document found, will not HMR CSS" when emit=false #943

ntucker opened this issue May 17, 2022 · 8 comments · Fixed by #953

Comments

@ntucker
Copy link
Contributor

ntucker commented May 17, 2022

Bug report

When using webpack devserver with a server and client bundle where the server bundle

Actual Behavior

"no window.document found, will not HMR CSS" is output to the console

Expected Behavior

Since emit = false, there is no need to attempt HMR anyway so simply ignore this

How Do We Reproduce?

  1. checkout https://github.com/ntucker/anansi/tree/25803a5b49316c7e73846efbe774d5cbe3eb28a3
  2. yarn install
  3. yarn build:pkg
  4. cd examples/concurrent
  5. yarn start
  6. observe logging statement

Please paste the results of npx webpack-cli info here, and mention other relevant information

  System:
    OS: Linux 5.10 Ubuntu 20.04 LTS (Focal Fossa)
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 26.13 GB / 31.30 GB
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 3.2.1 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
    npm: 8.7.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
@alexander-akait
Copy link
Member

You need to use different setup for server and client, but you miss How Do We Reproduce?, so I can't help

@ntucker
Copy link
Contributor Author

ntucker commented May 17, 2022

I do use different setup for server - I set emit = false as described here: https://github.com/webpack-contrib/mini-css-extract-plugin#emit. I still need the css stuff to run so the classnames are set properly to enable hydration

@alexander-akait
Copy link
Member

alexander-akait commented May 17, 2022

Why you run server chunk on client? Please fill out all fields in an issue template to avoid unnecessary questions

Sorry missed you already done it, thanks

@alexander-akait
Copy link
Member

alexander-akait commented May 17, 2022

Just intresting do you expected to reload CSS (it is possible too) or just avoid message?

@ntucker
Copy link
Contributor Author

ntucker commented May 17, 2022

Just to avoid the message... I believe the only reason it thinks HMR is running on server is because I'm using webpack-dev-server with hot = true and it's injecting the HMR stuff into entrypoint for both client and server bundle. However, that client code doesn't cause any problems itself; just that it seems to be triggering this console message

@ntucker
Copy link
Contributor Author

ntucker commented May 17, 2022

FYI: landed the branch to master so it's deleted now: https://github.com/ntucker/anansi/tree/25803a5b49316c7e73846efbe774d5cbe3eb28a3

@alexander-akait
Copy link
Member

I think we can improve check here, do you want to send a PR?

@ntucker
Copy link
Contributor Author

ntucker commented Jun 15, 2022

@alexander-akait done: #953

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

Successfully merging a pull request may close this issue.

2 participants