akveo / ngx-admin

Customizable admin dashboard template based on Angular 10+
https://akveo.github.io/ngx-admin/
MIT License
25.18k stars 7.94k forks source link

nativescripts/schematics, baseurl and paths #5546

Open Prefix1802 opened 4 years ago

Prefix1802 commented 4 years ago

I'm submitting a ... (check one with "x")

Current behavior: I am trying to implement nativescript/schematics. and i am experiencing some problems with the paths and baseurls. Normally when creating a new angular 8 project and installing nativescript/schematics, that works out of the box.

But when i use ngx admin master and install nativescript/schematics, It does not compile anymore.

The problem is related to tnsconfig.app.json in src with a baseUrl of "./". And somehow when you use paths you can not refer to a folder in the parent dir. e.g. @src mapping to ../src does not work.

nativescript/schematics also adds a paths in tsconfig.json one directory higher. And when u use paths a baseurl should be provided.

I believe, and read somewhere (though i can not find te link anymore) that it is impossible to have the baseurl in tsconfig.app.json in a subdirectory and add a path to a directory one level up/parent.

Expected behavior: baseurl should be migrated from tsconfig.app.json to tsconfig.json

Steps to reproduce: fresh install ngx admin master. ng add @nativescript/schematics. ng serve.

Angular 8

Prefix1802 commented 4 years ago

Nevermind, got it working with a few tweaks.

install ngx admin master, ng add @nativescript/schematics add "baseUrl": "." in tsconfig.json before paths. In main.tns.ts, app.module.tns.ts, app-routing.module.tns.ts rename src to @src

Now your mobile app is working, but for ngx-admin web you need to do these additional steps.

in tsconfig.app.json comment out baseURL and the files section. in app.module.ts rename src to @src in app-routing.module.ts add @src/ to import('app/pages/pages.module')

Sidenote: These instructions are for use with ngx admin. When u start an empty angular project, import nebular and install nativescript/schematics, you do not need to do this, works out of the box.