0

I've created 2 files: "config.debug.ts" & "config.release.ts". My understanding is that NativeScript's build script should copy the appropriate file to "config.ts" during the build. And then I should be able to do something like "import { config } from './config'" from my other *.ts files. That however does not happen and I'm getting a compilation error when doing "tns run".

Now, I'm in doubt if I'm doing this properly at all.. What is the "true NS" way to have different configs for debug & release builds?

Dmytro Gokun
  • 405
  • 3
  • 24
  • You can use [nativescript-hook-debug-production](https://www.npmjs.com/package/nativescript-hook-debug-production) plugin for defining different configuration for production and release. – Nikolay Tsonev Sep 26 '18 at 06:21
  • @NikolayTsonev did you try it? I did and it did not work. The compiler produces error at this line: "import { config } from './config'". Says file "config.ts" is not found. I also can see that file is not created on the disk. – Dmytro Gokun Sep 27 '18 at 07:04
  • If you are facing an issue with the plugin you can contact the author by opening a new issue here - https://github.com/markosko/nativescript-hook-debug-production/issues. In the meantime, you can also check the link here - https://github.com/NativeScript/NativeScript/issues/3012#issuecomment-258098152, where it is shown how to set up config base on the mode(`debug `, `release`) – Nikolay Tsonev Sep 27 '18 at 12:27

0 Answers0