I recently made some changes to my Angular7 app, including an upgrade to Angular7 and upgrading package dependencies. However, I encountered an issue when testing my app on PROD Internet Explorer 11. While there are no problems when testing on localhost, once the app is deployed to PROD, I receive the following error:
SCRIPT1003: Expected ':'
main-client.js (559,109)
Upon investigating the main-client.js file, I found the following line causing the error:
Pr={"ɵdefineBase":defineBase,
"ɵdefineComponent":defineComponent,
"ɵdefineDirective":H,
defineInjectable, ## This is line:559 and column:109 ##
The issue lies with the line defineInjectable
, which should be
"defineInjectable": defineInjectable
. I tested the correction in the IE11 developer tools with the following example:
c = 3; d=4; values = {a:1, b:2, c, d} output is: Expected ':'
However, IE11 expects it to be written as:
c = 3; d=4; values = {a:1, b:2, c:c, d:d} outpus is: OK
It is possible that the issue is related to the ECMAScript version or Webpack settings as I use webpack for building the application. I have not been able to pinpoint the exact cause. If needed, I can provide my webpack.config files. Here are my tsconfig files:
tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node",
"module": "es2015",
"target": "es5",
"alwaysStrict": true,
"noImplicitAny": false,
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"allowUnreachableCode": false,
"lib": [
"es2016",
"dom"
],
"types": [ "node" ]
},
"include": [
"ClientApp"
]
}
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"sourceMap": true,
"types": ["node"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": ["jasmine", "node"]
},
"files": ["polyfills.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}