You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have upgraded from v4.0.5 to v4.1.1. When compiling with Webpack 5, it fails with this error:
ERROR in ./node_modules/redux/node_modules/@babel/runtime/helpers/esm/objectSpread2.js 1:0-46
Module not found: Error: Can't resolve './defineProperty' in '/home/alex/Projects/soapbox-fe/node_modules/redux/node_modules/@babel/runtime/helpers/esm'
Did you mean 'defineProperty.js'?
BREAKING CHANGE: The request './defineProperty' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve './defineProperty' in '/home/alex/Projects/soapbox-fe/node_modules/redux/node_modules/@babel/runtime/helpers/esm'
using description file: /home/alex/Projects/soapbox-fe/node_modules/redux/node_modules/@babel/runtime/helpers/esm/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /home/alex/Projects/soapbox-fe/node_modules/redux/node_modules/@babel/runtime/helpers/esm/package.json (relative path: ./defineProperty)
Field 'browser' doesn't contain a valid alias configuration
/home/alex/Projects/soapbox-fe/node_modules/redux/node_modules/@babel/runtime/helpers/esm/defineProperty doesn't exist
webpack compiled with 1 error
You're shipping a package.json with "type": "module" but the code is importing modules without the extension.
These are all the same issues. In .mjs files or .js files with a package.json with "type": "module" imports need to be fully specified. This means you need to have an extension.
That how ESM in node.js is defined, and you are opting in into this behavior by using the .mjs extension resp the field in the package.json.
We didn't enforce this behavior in previous versions while this was still experimental in node.js, but it left this status, so I feel ok with enforcing this and pointing out these incorrect packages.
Yes Javascript is insane, everything is everyone's problem and no one's problem. But do you want Redux to work correctly in Webpack 5?
I'm not the first to have this problem and I won't be the last. I'm just the first to report it.
Your incredibly rude and dismissive response makes me wonder why I waste my time. I've already worked around the problem, but the reality is that this is a bug in your software. Just thought you might like to know!
I get it. Open source is hard. People are ungrateful. I know that better than anyone. But come back to Earth for 5 seconds and reread this please.
Reacted by Artёm, Ivar Nakken, Ivan Fedulov, AS, Tyler Reiff, aliveornot, Miguel Carvajal, Widget, Roberto Mauro, Al Urim and 3 more
Reacted by Brett Jackson, Dawid Buliński, David May and Joel Lithgow
This is actually a Babel issue, we're just one of the transitive dependencies that brought it to your attention. The good news is it was fixed in babel/babel#10853 and shipped in 7.12.0. Make sure you're using at least that version and you should be good to go.
Reacted by Matt Sutkowski, Tomáš Dvořák and David May
This seems like a package manager problem, but it doesn't help that redux has "@babel/runtime": "^7.9.2" listed as a dependency when this problem was fixed in v7.12.0.
I'm struggling to make it not put a node_modules folder with an outdated version in there:
It was the lock file. Apparently yarn add redux@latest isn't good enough. yarn upgrade redux (and upgrading a bunch of other deps that way) finally fixed it. Thanks for your help.
Activity
timdorr commentedon Sep 16, 2021
This isn't a Redux issue.
alexgleason commentedon Sep 16, 2021
🤔 Did you read webpack/webpack#11467 ?
You're shipping a package.json with
"type": "module"but the code is importing modules without the extension.Yes Javascript is insane, everything is everyone's problem and no one's problem. But do you want Redux to work correctly in Webpack 5?
alexgleason commentedon Sep 16, 2021
I'm not the first to have this problem and I won't be the last. I'm just the first to report it.
Your incredibly rude and dismissive response makes me wonder why I waste my time. I've already worked around the problem, but the reality is that this is a bug in your software. Just thought you might like to know!
I get it. Open source is hard. People are ungrateful. I know that better than anyone. But come back to Earth for 5 seconds and reread this please.
timdorr commentedon Sep 16, 2021
My man, please take a chill pill. It'll be OK.
We aren't shipping a
"type": "module"package. Here's our package.json as it exists on npm: https://unpkg.com/browse/redux@4.1.1/package.jsonThis is actually a Babel issue, we're just one of the transitive dependencies that brought it to your attention. The good news is it was fixed in babel/babel#10853 and shipped in 7.12.0. Make sure you're using at least that version and you should be good to go.
alexgleason commentedon Sep 16, 2021
This seems like a package manager problem, but it doesn't help that redux has
"@babel/runtime": "^7.9.2"listed as a dependency when this problem was fixed in v7.12.0.I'm struggling to make it not put a node_modules folder with an outdated version in there:
markerikson commentedon Sep 16, 2021
I'm kinda confused, because by definition,
^7.9.2should install the latest at the time that you run the installation, so7.12or whatever's out now.What other versions of
@babel/runtimeare being requested in your project right now?alexgleason commentedon Sep 16, 2021
It was the lock file. Apparently
yarn add redux@latestisn't good enough.yarn upgrade redux(and upgrading a bunch of other deps that way) finally fixed it. Thanks for your help.artyom-88 commentedon Jan 27, 2022
Adding
@babel/runtime": ">=7.16.7"toyarnresolutionshelped to solve the problem.