When trying to get Angular 13 to work properly, found a few issues that might or might not be related to Xplat. However I will post them here so that you can see if you need to update anything or any dependencies.
npx nx run nativescript-testing:ios
> nx run nativescript-testing:ios
---
Running NativeScript CLI within apps/nativescript-testing/
ns debug ios --force
---
Error while loading nativescript-cloud is: Default commands should be required before child commands
Searching for devices...
> testing@0.0.0 postinstall
> node ./tools/xplat-postinstall.js
Copying ../../hooks -> hooks
up to date, audited 24 packages in 876ms
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
> testing@0.0.0 postinstall
> node ./tools/xplat-postinstall.js
Copying ../../hooks -> hooks
up to date, audited 24 packages in 735ms
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
Copying template files...
Platform ios successfully added. v8.1.0
Preparing project...
Error [ERR_REQUIRE_ESM]: require() of ES Module /git/nx/workspaces/testing/node_modules/@angular/compiler-cli/bundles/index.js from /git/nx/workspaces/testing/node_modules/@ngtools/webpack/src/ivy/plugin.js not supported.
Instead change the require of index.js in /git/nx/workspaces/testing/node_modules/@ngtools/webpack/src/ivy/plugin.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/git/nx/workspaces/testing/node_modules/@ngtools/webpack/src/ivy/plugin.js:30:24)
at Object.<anonymous> (/git/nx/workspaces/testing/node_modules/@ngtools/webpack/src/ivy/index.js:13:16)
at Object.<anonymous> (/git/nx/workspaces/testing/node_modules/@ngtools/webpack/src/index.js:33:34)
at getAngularCompilerPlugin (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/configuration/angular.js:218:39)
at default_1 (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/configuration/angular.js:87:35)
at /git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/index.js:129:13
at Array.forEach (<anonymous>)
at resolveChainableConfig (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/index.js:127:10)
at Object.resolveConfig (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/index.js:156:42)
at module.exports (/git/nx/workspaces/testing/apps/nativescript-testing/webpack.config.js:20:18)
at Command.<anonymous> (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/bin/index.js:66:44)
at Command.listener [as _actionHandler] (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:488:17)
at /git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:1227:65
at Command._chainOrCall (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:1144:12)
at Command._parseCommand (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:1227:27)
at Command._dispatchSubcommand (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:1050:25)
at Command._parseCommand (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:1193:19)
at Command.parse (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/node_modules/commander/lib/command.js:897:10)
at Object.<anonymous> (/git/nx/workspaces/testing/node_modules/@nativescript/webpack/dist/bin/index.js:106:21) {
code: 'ERR_REQUIRE_ESM'
}
No configuration!
Executing webpack failed with exit code 0.
Fix to abovenpm install @ngtools/webpack@13.0.4
NGCC incorrect import
npm install
> testing@0.0.0 postinstall
> node ./tools/xplat-postinstall.js
Copying ../../hooks -> hooks
node:internal/modules/cjs/loader:488
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './ngcc/main-ngcc.js' is not defined by "exports" in /git/nx/workspaces/testing/node_modules/@angular/compiler-cli/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object.<anonymous> (/git/nx/workspaces/testing/apps/nativescript-testing/tools/xplat-postinstall.js:18:26)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Fix to above
The Xplat post install script must be updated git/nx/workspaces/testing/apps/nativescript-testing/tools/xplat-postinstall.js with something like this:
const ngccPath = require.resolve('@angular/compiler-cli/ngcc');
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: The injectable 'PlatformLocation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.
The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.
Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
at
getCompilerFacade(file: src/webpack:/testing/node_modules/@angular/core/fesm2015/core.mjs:4051:0
at …µ…µngDeclareFactory(file: src/webpack:/testing/node_modules/@angular/core/fesm2015/core.mjs:28536:0
at ../../node_modules/@angular/common/fesm2015/common.mjs(file: src/webpack:/testing/node_modules/@angular/common/fesm2015/common.mjs:90:45
at __webpack_require__(file: src/webpack:/testing/webpack/bootstrap:24:0
at fn(file: src/webpack:/testing/webpack/runtime/hot module replacement:61:0
at ../../node_modules/@nativescript/an
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: The injectable 'PlatformLocation' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.
The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.
Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
at
getCompilerFacade(file: src/webpack:/testing/node_modules/@angular/core/fesm2015/core.mjs:4051:0
at …µ…µngDeclareFactory(file: src/webpack:/testing/node_modules/@angular/core/fesm2015/core.mjs:28536:0
at ../../node_modules/@angular/common/fesm2015/common.mjs(file: src/webpack:/testing/node_modules/@angular/common/fesm2015/common.mjs:90:45
at __webpack_require__(file: src/webpack:/testing/webpack/bootstrap:24:0
at fn(file:///app/runtime.js:
When trying to get Angular 13 to work properly, found a few issues that might or might not be related to Xplat. However I will post them here so that you can see if you need to update anything or any dependencies.
Ivy not supported Might be related to https://github.com/angular/angular/issues/43833
Fix to above
npm install @ngtools/webpack@13.0.4
NGCC incorrect import
Fix to above The Xplat post install script must be updated git/nx/workspaces/testing/apps/nativescript-testing/tools/xplat-postinstall.js with something like this:
const ngccPath = require.resolve('@angular/compiler-cli/ngcc');
Nativescript issue Related to: https://github.com/NativeScript/angular/issues/44
Fix to above
This is my working package configuration after a few attempts with NS: