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

Webpack 5 with browserslist config breaks react-refresh plugin #235

Closed
bentrynning opened this issue Oct 26, 2020 · 3 comments · Fixed by #283
Closed

Webpack 5 with browserslist config breaks react-refresh plugin #235

bentrynning opened this issue Oct 26, 2020 · 3 comments · Fixed by #283

Comments

@bentrynning
Copy link

bentrynning commented Oct 26, 2020

Versions
"webpack": "5.1.3",
"webpack-cli": "4.1.0",
"webpack-dev-server": "3.11.0"
"@pmmmwh/react-refresh-webpack-plugin": "0.4.2"
"react-refresh": "0.9.0",

Since updateing to webpack 5 react-refresh plugin stops working. Looks like it has something to to with the target in webpack being set to target: browserslist when browserslist config is present in repository. This is new in webpack 5

It can be reproduced by ether adding .browserlistrc or browserslist to package.json

I could be that this is some issue with react-refresh, but ill try my luck here first :)

Workaround is to explicit set target: 'web' when in development in webpack config.
Test repo: https://github.com/bentrynning/react-refresh

@anajavi
Copy link

anajavi commented Oct 28, 2020

This seems to be related:
webpack/webpack-dev-server#2758

@pmmmwh
Copy link
Owner

pmmmwh commented Nov 1, 2020

This is unfortunately a problem from upstream - no code in the plugin is specific for the web and would stay that way.

hyochan added a commit to hyochan/dooboo-frontend-ts that referenced this issue Nov 3, 2020
hyochan added a commit to hyochan/dooboo-frontend-ts that referenced this issue Nov 3, 2020
Update packages and migrate to webpack5. We had an issue in react-fast-refresh on webpack5 but could resolve this issue with the workaround given in pmmmwh/react-refresh-webpack-plugin#235.
@pmmmwh
Copy link
Owner

pmmmwh commented Nov 30, 2020

This have been resolved in webpack-dev-server@4.0.0-beta.0

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.

3 participants