[Bug] [MODULE_NOT_FOUND] error for @types package when using webpack.config.ts
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
Getting lots of error for types packages on yarn 2.1.1
When using TS file as webpack configuration. https://webpack.js.org/configuration/configuration-languages/#typescript
(node:67829) [MODULE_NOT_FOUND] Error: @types/react-dom tried to access react, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
To Reproduce
I’ve setup a repo that can reproduce this issue.
https://github.com/missing1984/yarn2-webpack-ts
run yarn && yarn build
you would be able to see the warning.
Environment if relevant (please complete the following information):
- OS: OSX
- Node version 12
- Yarn version 2.1.1
pnpFallbackMode: “dependencies-only”
Additional context
See discord discussion.
https://discord.com/channels/226791405589233664/654372321225605128/733439592614592604
Add any other context about the problem here.
looks like webpack-cli
internally invoke ts-node to transpile configurations. I am not sure if this is a valid use case for pnp…
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Fixed in https://github.com/yarnpkg/berry/pull/1623
Am getting similar warning messages on
2.1
as well as afteryarn set version from sources
, but in my case it only appears when runningjest
oreslint
FWIW: prior to updating the repo’s Yarn 2 version/source, the last commit in the version we were using was on the 25th of June. So something in between the 25th of June and Yarn 2.1’s release date (9th of July?) introduced these warning messages.