Before describing the problem I show my env
Ionic:
Ionic CLI : 6.13.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.4
@angular-devkit/build-angular : 0.1101.4
@angular-devkit/schematics : 11.2.1
@angular/cli : 11.1.4
@ionic/angular-toolkit : 3.1.0
Cordova:
Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : 0.15.3
native-run (update available: 1.3.0) : 0.2.9
System:
ios-deploy : 1.11.4
ios-sim : 8.0.2
NodeJS : v15.8.0 (/usr/local/Cellar/node/15.8.0/bin/node)
npm : 7.5.0
OS : macOS Big Sur
Xcode : Xcode 12.4 Build version 12D4e
I have an Ionic 5 app working on Android 5.1.1 and I want to migrated it to Angular 11 so I created a new empty from the scratch project using
ionic start TestForUpgrade blank --cordova --type=ionic-angular
but this app shows a white screen on the device and the console error contains
polyfills.js:2664 Uncaught SyntaxError: Use of const in strict mode.
vendor.js:363 Uncaught SyntaxError: Unexpected token =
main.js:38 Uncaught SyntaxError: Use of const in strict mode.
I compared the working and the not-working projects and the polyfill.ts files are very similar, the working app contains many commented lines so the result doesn’t change
The files tsconfig.json
are very similar, the main difference is the module
value, so I changed the 2020
value present in the not-working with the esnext
present in the working app without success
Below the two tsconfig.json
files
The not working app tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": ["es2018", "dom"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
The working app tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
I’ve found many “solutions” on the web but none worked for me
Any hints?