Skip to content

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

@chensi66666

Description

@chensi66666

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 在国内就使用的比较少,如果该组件库不能对其他的一些包管理工具进行适配,那该组件库的推广和使用也会受到很大影响。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions