0

One of the popular package used during developing NativeScript apps is tns-platform-declarations

But should I install it as dependency or a dev-dependency?

plain.js
  • 64
  • 1
  • 6

2 Answers2

2

It's a dev-dependency

It's just a set of TypeScript declaration files for intellisense support.

Manoj
  • 21,753
  • 3
  • 20
  • 41
  • 1
    +1 I want to add that those files are really really BIG. Adding them as a `dependency` is not simply a bad practice but will also cause the build app to be significantly larger than expected. Always add them as a `devDependency` – Nick Iliev Jul 29 '19 at 11:48
1

On second thought (and after some additional research) with NativeScript 6, the webpack bundle is enabled by default. That means that all code is tree-shaken and only JavaScript files that are imported will be included in your outputted bundle (which will guarantee a smaller bundle size compared to the legacy workflow). As tns-platform-declaration is never imported those *.d.ts files will be tree shaken and not included in the bundle.

So with NativeScript 6 and above, there is no difference if the tns-platform-declarations will be a dependency or a devDependency BUT it is a good practice to differentiate the development libraries. So I would say that you should install it as a devDependency just to be more clear.

Nick Iliev
  • 9,610
  • 3
  • 35
  • 89