Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Compatibility with webpack-dev-server HMR. #174

Closed
aprilmintacpineda opened this issue Dec 12, 2018 · 17 comments
Closed

Compatibility with webpack-dev-server HMR. #174

aprilmintacpineda opened this issue Dec 12, 2018 · 17 comments

Comments

@aprilmintacpineda
Copy link

aprilmintacpineda commented Dec 12, 2018

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. Is there anything that the loader could do about this?

webpack/webpack-dev-server#1595

@ethansisson
Copy link

I'm also experiencing this issue.

@spencer-brown
Copy link

jFYI - a workaround has been recommended on the Webpack side here.

@masx200
Copy link

masx200 commented Jun 23, 2019

'm also experiencing this issue

@masx200
Copy link

masx200 commented Jun 24, 2019

output: {
       path: path.join(__dirname, 'dist'),
       filename: 'bundle.js'
       publicPath: 'http://localhost:3000',
       globalObject: 'this'
},

@masx200
Copy link

masx200 commented Jun 29, 2019

@alexander-akait
Copy link
Member

Somebody can create minimum reproducible test repo?

@kumar303
Copy link

@evilebottnawi I don't know if it's very minimal but I used create-react-app to make a simple example. https://github.com/kumar303/worker-loader-issue174

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

If I understand correctly, I can change the webpack config to transform window into this but that's tricky with create-react-app. I'm still thinking of ways to solve it.

@alexander-akait
Copy link
Member

@kumar303 it is happens only with webpack-dev-server?

@kumar303
Copy link

yes, I think so. In create-react-app, yarn start starts up in development mode.

@alexander-akait
Copy link
Member

@kumar303 if is happens only with webpack-dev-server, can you create issue in webpack-dev-server repo with reproducible test repo (no need minimum, just step how to reproduce problem)

@kumar303
Copy link

The title is misleading but this issue already exists in webpack-dev-server; it seems to be about the same exact problem: webpack/webpack-dev-server#1595

@alexander-akait
Copy link
Member

@kumar303 i think we should solve this instead exclude some files from HMR, because it is not good solution

@alexander-akait
Copy link
Member

alexander-akait commented Jul 10, 2019

Can you put example with reproachable steps in issue?

@davidawad
Copy link

davidawad commented Jul 11, 2019

I've been fighting with this issue for a few days. I can't seem to include pdfjs within create react app.

See wojtekmaj/react-pdf#190 developit/workerize-loader#5 and facebook/create-react-app#1574

None of their solutions solve my issue but I'd really love to see this solved.

@alexander-akait
Copy link
Member

I will look this on weekend

@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 the master, ETA is the end of week, big sorry for delay

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

No branches or pull requests

8 participants