webpack: Regression on v5.99.0, [something] not defined
Bug report
What is the current behavior?
Webpack builds the artefact just fine. When running the app, there is a reference error, which prevents the app from running.
I’ve verified version 5.99.0 is affected by downgrading to 5.98.0, on which the app works as expected. The same behaviour is observed in a production and development build (including the hot-reload setup).
If the current behavior is a bug, please provide the steps to reproduce.
Reporting this as soon as confirmed, but root cause is not detected just yet. Not enough time (yet) to provide a minimal reproduction.
What is the expected behavior?
Other relevant information: webpack version: 5.99.0 Node.js version: v22.14.0 Operating System: MacOS and Ubuntu Additional tools: n/a
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 18
- Comments: 81 (40 by maintainers)
Commits related to this issue
- STCLI-267 pin webpack to v5.98.0 `webpack` `v5.99.0` brought features like checking for dead flow-control statements and, the ability to generate custom error content, and improved support for `impor... — committed to folio-org/stripes-cli by zburke 2 years ago
- STCLI-268 bump webpack to ^5.99.3 Bump `webpack` to `^5.99.3` to avoid hiccups in the early `5.99.x` releases, e.g. https://github.com/webpack/webpack/issues/19394. Replaces PR #386. Refs STCLI-268 — committed to folio-org/stripes-cli by zburke 2 years ago
- STCLI-268 bump webpack to ^5.99.6 (#387) Bump `webpack` to `^5.99.6` to avoid hiccups in the early `5.99.x` releases, e.g. https://github.com/webpack/webpack/issues/19394. Replaces PR #386. Refs STC... — committed to folio-org/stripes-cli by zburke 2 years ago
Please try - https://github.com/webpack/webpack/releases/tag/v5.99.1 and feedback welcome, hope catch all cases
@RaananW Please try https://github.com/webpack/webpack/releases/tag/v5.99.4
@MarshallOfSound @alicelovescake Please try https://github.com/webpack/webpack/releases/tag/v5.99.2, hope I covered all cases…
Repro: https://github.com/thorn0/webpack-5.99.0-repro Works fine with 5.98.0. Errors with 5.99.0:
I will add your test case to avoid future regressions, anyway thank you
Ok, actually nevermind. It does seem like one of the other changes fixed the issue. I was using an outdated version of webpack still. Sorry for the noise.
Namely, here:
https://github.com/ruffle-rs/ruffle/blob/5aa7f0276a78e9c222ff927539dce86c8876c73d/web/packages/extension/src/background.ts#L55-L61
I got Uncaught (in promise) ReferenceError: utils is not defined. utils is an import and the uses of it in try/catch were replaced just fine.
Looks like we fixed all cases I am going to close, anyway if you faced with this problem feel free to feedback or open anew issue, thank you everyone to help with examples and repos
@alexander-akait I’ve tried
5.99.5with demo project and the main one - both works so far, at least the issue with assert from tss-react now gone. I’ll do some more tests and let you know.Thanks a lot!
@alexander-akait I’m really sorry, but I think issue (or some of it’s part) is still somewhere here. I’ve made a demo-repo https://github.com/rtm-ctrlz/webpack-demo-issue19394 that still reproduces this issue, even with
5.99.4version. It has some outdated deps, but changing webpack version5.98.0 <-> 5.99.xmakes project work (or not). I used dev-server for tests - I my project I have issue in all build dev/production with and without dev-server. Hope it will help.P.S. BTW @GrantBartlett thanks for your template!
I also faced that issue in my project, I had
ReferenceError: assert is not definederror, im my case it wasassertfunction that is used (and bundled) by tss-react library. Using webpack versions5.99.0...5.99.3was building project with issue, but5.99.4managed to build application without that issue.Thanks @alexander-akait for your fixes!
Working correctly now (at least in one snippet that didn’t work). Will continue testing. You are awesome, thanks for the quick fix.
Thank you so much for the update!
@RaananW Found a problem WIP, hope is it the last
5.99.3 across the board
@ileandreKU Just update webpack to the latest version, always verify it using
npm ls webpackIf this helps, here is a snippet of code generated using 5.99.3:
The important reference is the “console.log” calls. They all log the same variable - a class imported, calls
Texture. For some reason, between the 2nd and 3rd log, the webpack reference is gone.I get this too, only 5.98.0 works, all 5.99.x are broken.
@alexander-akait Thanks for version 5.99.3! I was encountering the
Cannot use 'import.meta' outside a moduleerror with react-router in version 5.99 after upgrading from 5.98. However, the latest release (or one of the three recent patch releases) resolved the issue, though I’m not sure which one exactly. Either way, everything is working again.@alexander-akait This is working now, thank you
@alexander-akait for my app v5.99.2 works 👍
No issues so far with 5.99.2 for me, previously had
process is not definedwith 5.99.0.@MarshallOfSound Found a place and reproduce, WIP on fix, thanks for screenshot, it really helps
@alexander-akait here is the minified bundle output that had the error --> https://gist.github.com/MarshallOfSound/13dd3307261f26797ef908379821bef2
The error specifically in our bundle was
MessageFormatError is not definedThat class is part of the open source
react-intlpackage or one of it’s dependencies, I’ve tried to repro in an isolated webpack build but unfortunately without much success. Let me know if there’s anything that makes this easier to track for you@alexander-akait, we also struggled with the symptoms described here and 5.99.1 resolved them for us. Thank you!
This might be related but I also started having issues this morning: When upgrading to webpack 5.99.0, our application started experiencing a runtime error:
ReferenceError: shouldCancel is not definedin redux-saga. This error occurs at runtime in the redux-saga core module, specifically atredux-saga-core.esm.js:1150:14in thenextfunction of the compile module. But in reality it seems the webpack update affects the import of theshouldCancelfunction