Sage 9.0.9 Yarn build:production fails with Error: Cannot find module '../5/CheckObjectCoercible'

My yarn build works great, my yarn build: production though throws this:
Any ideas?

$ webpack --env.production --progress --config resources/assets/build/webpack.config.js
module.js:550
throw err;
^

Error: Cannot find module '../5/CheckObjectCoercible'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/mikey/Local Sites/crosses- 
music/app/bedrock/web/app/themes/sage/node_modules/es- 
abstract/2020/RequireObjectCoercible.js:3:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
error Command failed with exit code 1.

Looks like your modules are broken, try with re-installing YARN by yarn install --ignore-scripts && yarn build:production.

Also this PR may help, it fixes some sage 9 issues (and updates dependencies, webpack to v4):

that worked… ish… now my regular “yarn build” gives this error:
Failed to load plugin ‘import’ declared in ‘.eslintrc.js’: Cannot find module ‘…/5/CheckObjectCoercible’

I tried installing that plugin, no dice. Same error. I ended up downgrading to 9.0.9, works like a charm

You get this error when trying out the PR?

Hello! I don’t use Roots (I’m not a wordpress developer) but I got this error today with ESLint:

$ eslint --fix ./


Oops! Something went wrong! :(

ESLint: 8.39.0

Error: Failed to load plugin 'import' declared in '.eslintrc.js': Cannot find module '../5/CheckObjectCoercible'
Require stack:
- /home/trusktr/src/project/node_modules/es-abstract/2022/RequireObjectCoercible.js
- /home/trusktr/src/project/node_modules/array-includes/index.js
- /home/trusktr/src/project/node_modules/eslint-plugin-import/lib/ExportMap.js
- /home/trusktr/src/project/node_modules/eslint-plugin-import/lib/rules/named.js
- /home/trusktr/src/project/node_modules/eslint-plugin-import/lib/index.js
- /home/trusktr/src/project/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/trusktr/src/project/node_modules/es-abstract/2022/RequireObjectCoercible.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)

I’m not exactly sure what the issue was, although it looks like an in-range version mismatch in the dependencies. I tried npm install multiple times to no avail, however when I deleted my node_modules and tried again fresh, then it all worked and the error went away.