Skip to content

Nativescript and Angular code split, maven build failing #135

Open
@tsonevn

Description

@tsonevn

@iMarwan-k commented on Fri Oct 12 2018

Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI:
  • Cross-platform modules:
  • Android Runtime: 4.2.0
  • iOS Runtime: 4.2.0
  • Plugin(s):
  • NativeScript-Angular: ~6.1.0-rc.0
  • Angular: 6.1.0

Describe the bug

We are developing a project that sharing the code between nativescript and web. We used nativescript schematics to create the project, we have Java for back-end, Ng and {N} for front-end .

Right now, we are running an issue that when we run Maven to build the web project, we are getting an error while compiling .tns files. From Nativescript code split page we thought, excluding .tns at tsconfig.app.json file should do the job, but seems it is not

In the tsconfig.app.json file, we have the following

"exclude": [
    "**/*.spec.ts",
    "**/*.ns.ts",
    "**/*.tns.ts",
    "**/*.android.ts",
    "**/*.ios.ts"
  ]

example for component that share the code

about.component.ts
about.component.css
about.component.tns.html
about.component.html

example for component that is only mobile

welcome.componenet.tns.ts
welcome.componenet.tns.html
welcome.componenet.common.tns.css
welcome.componenet.ios.css
welcome.componenet.android.css

We are not sure why maven compiling .tns files and complaining about all tns-code-modules lib. Also platform dependents files like .ios.css and .android.css files, maven complain about couldn't resolve "welcome.component.css"

What we should do to exclude files like .tns and if we want to exclude entire folder like pre-login folder which is only mobile folder

Expected behavior
We expect to share code between the 2 platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions