如何在 stencil js 项目中添加 npm 包?

How to add an npm package inside stencil js project?

我正在创建一个在其中使用 npm 包的 stencil 项目,是否有任何选项可以在 stencil 项目中添加 npm 包。任何建议我都在寻找解决方案。

这就是我在 angular

中使用 ck-editor 的方式
<ck-editor name="editor" #myEditor [(ngModel)]="templateSetValue.template_content"
            (change)="handleEditorData($event)">
        </ck-editor>

是否可以使用相同的模板项目 https://www.npmjs.com/package/ngx-ckeditor

不确定我是否理解正确的问题,但是要从 npm 添加一个包到你的 Stencil.js 项目中,你可以像在任何其他节点项目中一样安装它:

npm install <some-package>

例如nprogress:

npm install nprogress @types/nprogress

然后像

一样将其导入您的代码中
import nprogress from 'nprogress';

nprogress.start();

// ...