Nativescript-angular: Cohabitation of ng2 webapp with NativeScript app

Created on 23 Nov 2016  路  4Comments  路  Source: NativeScript/nativescript-angular

_From @zackarychapple on November 22, 2016 16:17_

Tell us about the problem

I have an angular-cli generated angular2 app and its structure differs from the tns generated structure. I have been trying to figure out how can I change where tns looks for the main.ts to bootstrap the application. The goal is to have the web and native app living in the same repo and control switching between them via which main.ts is bootstrapped.

Which platform(s) does your issue occur on?

Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.4.0 with --ng flag

_Copied from original issue: NativeScript/NativeScript#3151_

Most helpful comment

Hey there, @zackarychapple! Great idea for having separate entry points for native and web ng2 app. You can change the main file for nativescript-angular from the package.json in the app folder. Simply change the following line:

"main": "main.js",

to something like:

"main": "main.tns.js",

or whatever you named your entry point.

All 4 comments

_From @bradmartin on November 23, 2016 3:48_

@zackarychapple - does this seed project help any? https://github.com/NathanWalker/angular-seed-advanced there is another seed too, just don't recall the repo right now.

@zackarychapple here is another great x-platform seed project:
https://github.com/shripalsoni04/nativescript-angular-web-starter

Hey there, @zackarychapple! Great idea for having separate entry points for native and web ng2 app. You can change the main file for nativescript-angular from the package.json in the app folder. Simply change the following line:

"main": "main.js",

to something like:

"main": "main.tns.js",

or whatever you named your entry point.

Closing due to inactivity.
Please, reopen if needed.

Was this page helpful?
0 / 5 - 0 ratings