Skip to content

chore: update dev workflow for Angular app #7861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

chore: update dev workflow for Angular app #7861

wants to merge 1 commit into from

Conversation

rynop
Copy link
Contributor

@rynop rynop commented Sep 24, 2019

PR Checklist

What is the current behavior?

When trying to contribute to tns-core*, and using an external NS Angular to develop/test these contributions, the compile step fails when following the instructions currently outlined in DevelopmentWorkflow.md (Running Another App).

@bundyo discovered this workaround, I'll paste his findings here:

The problem with linking is that Angular/TS project tend to grab the linked TS files in core modules and try to compile them without the references needed. I've only managed to run it by compiling the core modules with outDir and linking that (.d.ts, package.json and other files, except TS ones should be copied over too). Maybe the team can consider moving to an outDir compilation. Another way would be dev-webpack to forbid Angular/ts-loader for traversing node_modules.

What is the new behavior?

This PR contains a workaround for Angular that moves tns-core* to a new dist directory.

This workflow is obviously not ideal. Would love the NativeScript team's thoughts on a cleaner solution.

Fixes NativeScript/nativescript-dev-webpack#1044 and #7745

@cla-bot cla-bot bot added the cla: yes label Sep 24, 2019
@MartoYankov
Copy link
Contributor

While this works it requires lots of manual work, which is not ideal. Imho, it should work the same for Angular and TS project. Here are my thoughts:

  1. The Angular compiler seems to ignore or fail to resolve the references.d.ts in the tns-core-modules folder. If you add tns-platform-declarations and a references.d.ts to your app, the required references will be there. We can add this to the steps.
  2. It seems that even when you do 1. the Angular compiler still doesn't like the typescript in the core modules. We should perhaps investigate these errors. They seem to be connected to the interface exports in the d.ts files.

@bundyo
Copy link
Contributor

bundyo commented Sep 26, 2019

I'll make some tests where the problem is, since it is happening only in Angular (though I might have seen it in Vue+TS) and then we can address it in dev-webpack or, if not possible - create an automated script to deploy to another folder.

@MartoYankov
Copy link
Contributor

@bundyo I followed the steps from "running another app" plus one additional step - adding the tns-platform-declarations packages to the app. The errors that the ng compiler producers are with types and exports. I suspect these still happen in the regular ts-loader, but as warnings. The ng compiler is producing them as errors.

The reason why we don't want to promote alternative dev setups is because we can't support them. We adhere to the dev setup in the nativescript plugin seed to make sure the tns-core-modules have a similar setup to all plugins. What I mean is, we should fix the current setup or if not possible - change the dev setup in the plugin seed first.

@manoldonev
Copy link
Contributor

@rynop as elaborated by @MartoYankov I have logged a separate issue #7905 that we will need to address to fix the dev workflow in this scenario. I will close this PR for the time being.

@manoldonev manoldonev closed this Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Angular flavor crashes after splash
4 participants