Lets say I have a Typescript project like so
root/
api/
package.json
web/
package.json
...
package.json
In the root package.json I have the typescript dependency installed (this is to ensure it uses the same version in web & api).
If I install a package in web/package.json that has a peerDepedency on Typescript (lets say ts-loader) it will complain that Typescript is an unmet dependency.
root package.json
{
...
"devDependencies": {
"@types/node": "^11.11.7",
...
"typescript": "^3.3.4000"
}
}
web/package.json
{
...
"devDependencies": {
"ts-loader": "^5.3.3",
"webpack": "^4.29.6"
}
}
How do I get around this without adding Typescript in the web/package.json?
If thats not possible, how do you ensure that the same version of packages is used across multiple modules?
Unfortunately npm doesn't have any sort of package.json inheritance.
Since it's just a warning & everything should still work since node looks for node_modules in parent directories, I think you can do one of these:
ts-loader up to parent directoryIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With