Forum Discussion

Alex Podolsky's avatar
Alex Podolsky
Copper Contributor
Jul 23, 2017

Third party non-NPM packages integration with TypeScript-based Sharepoint Framework’s Web Part

Hello.

 

I have js file and d.ts file of some third party library that could not be installed through NPM installer.

I tried to integrate this package within Typescript-based Sharepoint Framework’s Web Part project but didn’t succeed.

I need a help and, if possible, an example solving this issue.

 

Thanks, Alex.

  • What library is it? What problem are you having? How are you trying to integrate it in your project?

    • Alex Podolsky's avatar
      Alex Podolsky
      Copper Contributor

      Hello, Waldek.

      The library I try to integrate is Keylines network library from Cambridge Intelligence Company.

      It's a proprietary library that is not distributed via NPM and can be accessed only with username and password at their dedicated web site.

      They provide js and d.ts files for a work with Typescript.

      I built a project with yeoman and I have to add manually js, d.ts files and reference them.

      How should I configure such kind of library and what is the best way to deal with libraries that are not exposed through NPM installer?

      Thanks, Alex.

      • Waldek Mastykarz's avatar
        Waldek Mastykarz
        MVP

        As you can't install it via NPM, you don't have much choice other than directly referencing it in your project. Because you have TypeScript type definitions, you should be able to include the reference using an import statement. I don't know the library you mentioned so can't tell exactly how that statement should look like. If it turns out that the library isn't distributed as a module, you can use a reference clause instead. It's a bit cryptic but it's hard to provide more details without knowing the library. Hope it helps.

Resources