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

allow us to exclude certain files from the HMR #1595

Closed
2 tasks done
aprilmintacpineda opened this issue Dec 12, 2018 · 10 comments
Closed
2 tasks done

allow us to exclude certain files from the HMR #1595

aprilmintacpineda opened this issue Dec 12, 2018 · 10 comments

Comments

@aprilmintacpineda
Copy link

aprilmintacpineda commented Dec 12, 2018

  • Operating System: MacOS
  • Node Version: 11.3.0
  • NPM Version: 6.5.0
  • webpack Version: 4.27.1
  • webpack-dev-server Version: 3.1.10
  • This is a bug
  • This is a modification request

Code

Sorry for not posting my config, I don't think it's related to that.

I'm using worker-loader which basically allows us to turn certain files into separate web worker with fallback capability for devices that does not support web workers.

But once your server starts up, you'll see this error on the console:

image

image

The error is coming from the web worker because window is not available on web workers.

Turning off HMR will fix the error BUT I want to be able to use HMR for other stuff. Maybe allow us to provide an option where we could exclude certain files from HMR?

@alexander-akait
Copy link
Member

@aprilmintacpineda problem in worker-loader, anyway you need reproducible test repo

@aprilmintacpineda aprilmintacpineda changed the title allow us to exclude certain files from the HRM allow us to exclude certain files from the HMR Dec 14, 2018
@spencer-brown
Copy link

web worker's can't use window; this isn't an issue in worker-loader. there's a related issue here.

@alexander-akait
Copy link
Member

/cc @spencer-brown sorry for delay, maybe you can create minimum reproducible test repo, it is allow other developers make fast test and search problem place to fix

@masx200

This comment has been minimized.

@masx200

This comment has been minimized.

@alexander-akait
Copy link
Member

@masx200 use English language, first warning

@kumar303
Copy link

Here is a "minimal" example built with create-react-app:

https://github.com/kumar303/worker-loader-issue174

The readme has instructions. The app gives me: ReferenceError: window is not defined

Other folks have had luck with setting output: { globalObject: 'this' } in a webpack config but it would be nicer if it just worked.

@alexander-akait
Copy link
Member

/cc @Loonride @hiroppy we need investigate in problem

@dangreen
Copy link

Hi there 👋

This is my solution to disable HMR for workers:
https://github.com/TrigenSoftware/hmr-filter-webpack-plugin#usage

@alexander-akait
Copy link
Member

Fixed in worker-loader repo, I don't think we really need to exclude some modules, we should fix compatibility with webpack-dev-server, anyway if you still think we need this, please open an issue in webpack repo, we can't implement this on our side

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

6 participants