postcss-loader: Cannot find module 'ts-node' (yarn)
Bug report
Actual Behavior
Attempts to build using this loader result in the following:
! Module build failed: Error: Cannot find module 'ts-node'
ERR! Require stack:
ERR! - /home/circleci/project/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.js
Expected Behavior
https://github.com/Codex-/cosmiconfig-typescript-loader/blob/main/package.json#LL39C6-L39C13
cosmiconfig-typescript-loader has a peerDep of ts-node. This module has cosmiconfig-typescript-loader as a dependency - therefore it should specify ts-node as a dependency as well.
How Do We Reproduce?
https://github.com/ntucker/anansi/pull/1941
Please paste the results of npx webpack info
here, and mention other relevant information
System:
OS: Linux 5.15 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (20) x64 AMD Ryzen 9 7950X 16-Core Processor
Memory: 27.62 GB / 31.21 GB
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
Yarn: 3.5.0 - ~/.yarn/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
Monorepos:
Yarn Workspaces: 3.5.0
Packages:
babel-loader: 9.1.2 => 9.1.2
webpack: 5.77.0 => 5.77.0
webpack-cli: 5.0.1 => 5.0.1
webpack-dev-server: 4.13.2 => 4.13.2
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 34 (29 by maintainers)
This still breaks for us. I think because
cosmiconfig-typescript-loader
is imported without check forts-node
here, which importsts-node
here. So probably the import ofcosmiconfig-typescript-loader
should become a dynamic import in this block right? wdyt @ntucker?https://github.com/webpack-contrib/postcss-loader/releases/tag/v7.2.2
https://github.com/webpack-contrib/postcss-loader/releases/tag/v7.2.3
What we need is a github action that let’s library authors verify compatibility easily so random libraries don’t accidentally violate these things. Even without those tools not specifying this properly leads to ambiguous resolution, which can lead to incredibly difficult to track down issues. It would have been better if these rules were in place at the inception but that’s a lot of ask of new tools
And I said it above that it doesn’t help, but for some reason no one listened to me
Yes, that’s why I included it in my PR https://github.com/webpack-contrib/postcss-loader/pull/639/files. You should be telling @alexander-akait this since he was the one asking about why typescript was needed.