admin管理员组文章数量:1318579
We're using NX for our monorepo setup and use a single package.json at the root to manage our dependencies. We're using Vite through the official Vite plugin for build and testing purposes.
Our repo contains some libraries that are published to NPM separately. When I built these libraries Vite generates the package.json using this config:
"build": {
"executor": "@nx/vite:build",
"options": {
"generatePackageJson": true,
}
}
NX automatically detects dependencies and adds them in the dependencies
I encountered an issue because Vite was also bundling the dependencies in my build output. I know I can fix this by listing these dependencies in my vite.config.ts
as external:
build: {
rollupOptions: {
external: [...],
},
},
However I would prefer not having to manually manage this list of exclusions. I found this rollup plugin but it unfortunately only works if those dependencies are listed as peerDependencies
.
So long description short: is there any configuration I can pass to NX/Vite to have the generated package.json of my libraries list the dependencies as peers?
本文标签:
版权声明:本文标题:npm - How can I configure NX to add dependencies as peers in my publishable libraries outputted package.json files? - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742046678a2417826.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论