Search code examples
stenciljsnpm-package

How to add an npm package inside stencil js project?


I am creating a stencil project which uses an npm package inside it, is there any options to add an npm package inside stencil project. Any suggestions I searching for a solution for quite a while.

This is how i use ck-editor in angular

<ck-editor name="editor" #myEditor [(ngModel)]="templateSetValue.template_content"
            (change)="handleEditorData($event)">
        </ck-editor>

Is it possible to use the same is stencil project https://www.npmjs.com/package/ngx-ckeditor


Solution

  • Not sure if I understood the question correctly, but to add a package from npm in your Stencil.js project, you can just install it, like you would in any other node project:

    npm install <some-package>
    

    For example nprogress:

    npm install nprogress @types/nprogress
    

    and then import it in your code like

    import nprogress from 'nprogress';
    
    nprogress.start();
    
    // ...