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

5.0.0-beta.14 with react-hot-loader breaks the app in development mode: "ReferenceError: exports is not defined" #10854

Closed
wojtekmaj opened this issue May 7, 2020 · 3 comments

Comments

@wojtekmaj
Copy link
Contributor

wojtekmaj commented May 7, 2020

Note: This has also been reported in react-hot-loader repo.

Bug report

What is the current behavior?

I'm getting an error "ReferenceError: exports is not defined" when running the application that imports d3-array in development mode (with react-hot-loader) built with 5.0.0-beta.14 and up.

Here's the exact error:

Uncaught ReferenceError: exports is not defined
    at register (cross.js?0cbf:23)
    at eval (cross.js?0cbf:23)
    at Object.../node_modules/d3-array/src/cross.js (charts.js:376)
    at __webpack_require__ (src.js:6070)
    at fn (src.952fd4b1.js:6330)
    at eval (index.js:18)
    at Object.../node_modules/d3-array/src/index.js (charts.js:496)
    at __webpack_require__ (src.js:6070)
    at fn (src.js:6330)
    at eval (band.js:5)

Reproducible repo

Any of the following seem to unbreak the app:

  • removing d3-array import (duh)
  • export default hot(Root) -> export default Root
  • applying react-hot-loader/webpack loader to /node_modules\/react-dom/ only and not /node_modules/

What is the expected behavior?

"Uncaught ReferenceError: exports is not defined" not to be thrown when executing Webpack-bundled code.

Other relevant information:
webpack version: 5.0.0-beta.14-5.0.0-beta.16
Node.js version: 12.16.2
Operating System: macOS Catalina
Additional tools: n/a

Tested other versions of Webpack, changing absolutely nothing but the Webpack version, and here's my findings:

Version Crashes?
4.43.0 ✅ No
5.0.0-beta.12 ✅ No
5.0.0-beta.13 ✅ No
5.0.0-beta.14 ❌ Yes
5.0.0-beta.16 ❌ Yes
@wojtekmaj wojtekmaj changed the title 5.0.0-beta.14 breaks the app: "ReferenceError: exports is not defined" 5.0.0-beta.14 breaks the app in development mode: "ReferenceError: exports is not defined" May 7, 2020
@wojtekmaj wojtekmaj changed the title 5.0.0-beta.14 breaks the app in development mode: "ReferenceError: exports is not defined" 5.0.0-beta.14 with react-hot-loader breaks the app in development mode: "ReferenceError: exports is not defined" May 8, 2020
@theKashey
Copy link

Because nor __webpack_exports__ nor exports are defined.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@webpack-bot
Copy link
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

@alexander-akait alexander-akait moved this from Important to Done in webpack 5 Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants