Skip to content

feat: add Angular 9 and Ivy support #2065

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 18 commits into from
Closed

Conversation

VladimirAmiorkov
Copy link
Contributor

PR Checklist

What is the current behavior?

Current package does not work with Angular 9.0.0-rc.1 version.

What is the new behavior?

Current package does works with Angular 9.0.0-rc.1 version.

Fixes/Implements/Closes #[Issue Number].
Resolves #2060

@VladimirAmiorkov VladimirAmiorkov self-assigned this Nov 12, 2019
@cla-bot cla-bot bot added the cla: yes label Nov 12, 2019
@VladimirAmiorkov VladimirAmiorkov removed their assignment Nov 30, 2019
@MattRiddell
Copy link

Any idea when this will be merged?

@NathanWalker
Copy link
Contributor

NathanWalker commented Feb 18, 2020

@MattRiddell I took over from where @VladimirAmiorkov left off and got things working with Ivy enabled here:
#2124

So everyone here does not need to wait until that new PR is merged, you can do the following to try the new v9 by doing the following:

  1. Download a prepacked @nativescript/angular v9 here:
    https://drive.google.com/file/d/1MyKOetI5aLc7gA_M3rKrNS-1RqztOwDs/view?usp=sharing

Put the .tgz file at root of your {N} project.

  1. Download a prepacked nativescript-angular compatibility reference here (this is mainly to allow other plugins which may not use the new @NativeScript scope to still work):
    https://drive.google.com/file/d/1xQ7O66qE2hmTbeChL1nbFqh4rCEEaor0/view?usp=sharing

Put the .tgz file at root of your {N} project.

  1. Then modify you package.json as follows:
  • Add to your scripts section:
"scripts": {
  "ngcc": "ngcc",
  "postinstall": "ngcc"
}
  • Modify dependencies as follows:
"@nativescript/angular": "file:nativescript-angular-v9.tgz",
"nativescript-angular": "file:nativescript-angular-compat.tgz",

Then just make sure all your @angular dep's are updated to ~9.0.0, for example:
"@angular/core": "~9.0.1"

Also make you are using at least 1.4.0 or 1.5.0 of nativescript-dev-webpack in devDependencies.

  1. Modify your tsconfig.json to include this (parallel to compilerOptions):
"compilerOptions": {
  ...your various options, etc.
},
"angularCompilerOptions": {
    "enableIvy": true
}

Then clean you project completely:

rm -rf node_modules/ platforms/ package-lock.json hooks

Then run with the following:

tns run ios --emulator --env.aot --no-hmr

Best to always use AoT all the time since Ivy works with it by default and also good to disable hmr as seems there's some other things to get hmr working with ivy.

If you end up seeing an error like this:

ERROR in The target entry-point "nativescript-ngx-fonticon" has missing dependencies:
 - file-system

You can add a new file ngcc.config.js to the root of your project with contents like this which helps the ngcc compiler for Ivy:

module.exports = {
  "packages": {
      "@nativescript/angular": {
          "entryPoints": {
              ".": {
                  "override": {
                      "main": "./index.js",
                      "typings": "./index.d.ts",
                  },
                  "ignoreMissingDependencies": true,
              }
          }
      },
      "nativescript-ngx-fonticon": {
          "entryPoints": {
            ".": {
                "override": {
                  "main": "./nativescript-ngx-fonticon.js",
                  "typings": "./nativescript-ngx-fonticon.d.ts",
                },
                "ignoreMissingDependencies": true,
            }
          }
      },
      "@nota/nativescript-accessibility-ext": {
          "entryPoints": {
            ".": {
                "override": {
                  "main": "./index.js",
                  "typings": "./index.d.ts",
                },
                "ignoreMissingDependencies": true,
            }
          }
      }
  }
}

Then try cleaning project and rebuild/run again after adding the ngcc.config.js file.

@thegnuu
Copy link

thegnuu commented Mar 3, 2020

Is there an estimated date when this will be available?

We are using immer in our application and we need typescript 3.7 that we are able to create our next release ;)

I know that I am able to patch this version into our project, but I am not really under pressure to create a new release and if it takes just a few weeks to publish this I would like to wait for the release...

If it will take months I am happy to follow the instructions to patch it!

Thank you for your help!

@mavaanan
Copy link

mavaanan commented Mar 3, 2020

We would also need this support ASAP. Can you give some time estimate for Angular 9.0.2+ support?

@abcfoundry
Copy link

Is this progressing? Releases used to be aligned with Angular, has something changed in the relationship with working with the google team?

@VladimirAmiorkov
Copy link
Contributor Author

With deep sadness I must inform you that I am no longer working on the NativeScript project. It has been a great journey and my work on the Angular 9 Ivy implementation in NativeScript has been taken over in the this PR #2124 . Please follow it and contribute to it as you can.

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 9
6 participants