Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否能支持 npm install --omit=optional 的安装方式? #8793

Closed
filefoxper opened this issue Dec 20, 2024 · 2 comments
Closed

是否能支持 npm install --omit=optional 的安装方式? #8793

filefoxper opened this issue Dec 20, 2024 · 2 comments

Comments

@filefoxper
Copy link

Discussed in #8764

Originally posted by filefoxper December 18, 2024
在一些大型项目中,有大量只服务于开发过程的包,通常会被开发团队放在 optionalDependencies 中。在生产环境使用 npm install --omit=optional 的安装方式可以忽略这些只服务于开发过程的包。而 npm install --omit 并没有提供针对个别包的豁免权,这会导致 @rspack/binding 无法正常安装核心包的问题(因为核心包是放在 @rspack/binding/package.json 的 optionalDependencies 中的)。

思路:可以学习一下 esbuild ,在@rspack/binding 包的 package.json 中加入 postinstall 脚本,在安装完毕时,检查并补全缺失的包。希望可以支持一下,谢谢。

@inottn
Copy link
Collaborator

inottn commented Dec 20, 2024

Duplicate with: #8762

@filefoxper
Copy link
Author

我把这个关一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants