question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Can't resolve './defineProperty'

See original GitHub issue

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

It seems to be related to this issue: https://github.com/webpack/webpack/issues/11467

Adding the following into my Webpack rules fixes the problem:

  {
    test: /\.m?js/,
    resolve: {
      fullySpecified: false,
    },
  },

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
alexgleasoncommented, 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.

2reactions
alexgleasoncommented, Sep 16, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix - Module not found: Can't resolve '@babel/runtime ...
I am working on a project of react and I am getting the following error after implement this package https://www ...
Read more >
Do you want to work on this issue? - Issuehunt
ModuleNotFoundError: Module not found: Error: Can't resolve '. ... defineProperty' failed to resolve only because it was resolved as fully specified ...
Read more >
XDN 2.34.1 version breaks build - Edgio Community Forums
ModuleNotFoundError: Module not found : Error: Can't resolve './defineProperty' in '/app/node_modules/@babel/runtime/helpers/esm'
Read more >
Cannot find module '@babel/runtime/helpers/defineProperty ...
https://sentry.gitlab.net/gitlab/gitter-backend-staging/issues/1061173/ Error: Cannot find module '@babel/runtime/helpers/defineProperty' ...
Read more >
Cannot find module 'babel-runtime/helpers/asyncToGenerator'
I had the exact same error, it went away as soon as I moved the .env file outside the src/ folder. Not using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found