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

[Bug]: 在使用 pnpm 和 yarn 等包管理工具安装 @opentiny/ng 时,未自动安装 @opentiny/ng-button 等依赖 #19

Open
chensi66666 opened this issue Oct 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@chensi66666
Copy link

Version

1.0.1

Angular Version

15.2.0

Link to minimal reproduction

https://www.npmjs.com/package/@opentiny/ng/v/1.0.0?activeTab=code
中的package.json

Step to reproduce

安装pnpm

npm install -g pnpm

创建一个项目

ng new opentiny-test --routing=true --strict=true --style=scss--package-manager=pnpm

安装 opentiny

pnpm install @opentiny/ng @angular/cdk

在app.component.html 里面写如下代码

<button tiButton>次要按钮</button>

在 app.module.ts 里 导入模块

`import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { TiButtonModule } from '@opentiny/ng-button';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
TiButtonModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
`

import { TiButtonModule } from '@opentiny/ng-button'; 这个会报错,@opentiny/ng-button 不会被安装在 node_modules 里。

What is expected

@opentiny/ng-button 等依赖应该一起安装

What is actually happening

@opentiny/ng-button 等依赖没被安装

Any additional comments (optional)

如果要让它正常工作,就必须在项目 package.json 里 引入 每个需要的依赖。会很麻烦,也很冗余,不方便日常开发。

其他包管理工具如 yarn 也会出现同样的问题。原因在于 @opentiny/ng 里的依赖 全写在 peerDependencies 不会被自动下载,希望能够考虑直接写在 dependencies 里 或者使用其他解决方案。

开发中,各个团队为了优化安装和处理依赖的速度,会选择 pnpm、yarn 等工具。angular 在国内就使用的比较少,如果该组件库不能对其他的一些包管理工具进行适配,那该组件库的推广和使用也会受到很大影响。

@chensi66666 chensi66666 added the bug Something isn't working label Oct 27, 2023
@chensi66666 chensi66666 changed the title [Bug]: [Bug]: 在使用 pnpm 和 yarn 等包管理工具安装 @opentiny/ng 时,未自动安装 @opentiny/ng-button 等依赖 Oct 27, 2023
@lareinaa01
Copy link

我们现在就换成了pnpm,也是遇到这种情况,请问您现在有什么更好的解决办法吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants