Ngx-admin: nativescripts/schematics, baseurl and paths

Created on 19 Oct 2019  路  1Comment  路  Source: akveo/ngx-admin

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

  • [X] bug report
  • [ ] feature request
  • [ ] question about the decisions made in the repository

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

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

burtonator picture burtonator  路  3Comments

xandatspain picture xandatspain  路  3Comments

nfdavenport picture nfdavenport  路  3Comments

igorls picture igorls  路  3Comments

maxlein picture maxlein  路  3Comments