Ts-loader: Cannot read property 'constructor' of undefined after dependency updates

Created on 11 Jan 2021  路  3Comments  路  Source: TypeStrong/ts-loader

Hey there, this started happening with the recent dependency updates

Expected Behaviour

Working build

Actual Behaviour

Module build failed (from ./node_modules/ts-loader/index.js):
TypeError: Cannot read property 'constructor' of undefined
at Object.getTypeScriptInstance (/home/stan/projects/work/platform-documentation/mkdocs-material/node_modules/ts-loader/dist/instances.js:33:40)
at Object.loader (/home/stan/projects/work/platform-documentation/mkdocs-material/node_modules/ts-loader/dist/index.js:16:41)

Steps to Reproduce the Problem

Location of a Minimal Repository that Demonstrates the Issue.

https://github.com/squidfunk/mkdocs-material/master

Most helpful comment

Ugh, interesting. Yeah a rm -rf node_modules fixed it. Sorry!

All 3 comments

I cannot reproduce. Cloned the repo. Ran npm i. Ran npm run build. Everything was successful. No errors.
Make sure your local node_modules folder is not messed up (duplicate/old versions) or anything. Retry with a fresh clone.

Also, the new version no longer uses the .constructor lookup (old chalk api), so the error points to an older version of ts-loader being used.

Ugh, interesting. Yeah a rm -rf node_modules fixed it. Sorry!

Was this page helpful?
0 / 5 - 0 ratings