4

We have an application that needs to be supported in old Chrome (v79).

Angular Version 13.2.7 Typescript Version 4.5.5 Node Version 16.14.0

We are getting an error:

ERROR: Big integer literals are not available in the configured target environment

When we set target as 2017 (anything less than 2020) & optimization is enabled for the build. BigInt are part of es2020 specification & I could not find a polyfill that works.

When we set target as es2020, error with BigInt is resolved, angular build is successful but application fails to open in Chrome 79 due to error Unrecognized character. This is happening as for es2020 optional chaining (?.) & nullish coalescing is not transpiled by typescript as these operators are natively supported in es2020 target. So we can neither stay on es2017 nor jump to es2020. I looked into using Babel transpilation with Angular, WebPack but nothing worked. Is anyone able to fix this issue?

1
  • @JSONDerulo we have legacy adobe flex applications that do not work Chrome 80 & later versions, last working version is Chrome 79, this browser version is wrapped in another desktop applications which users use to use our application. browserlstrc works in general targeting older version, but we are in this peculiar situation as I mentioned in the post Commented Jan 23 at 7:32

2 Answers 2

1

You can prevent the error by adding es2020.bigint to the lib array in your tsconfig.json:

{
  "target": "es2017",
  "lib": ["es2017", "dom", "es2020.bigint"]
}

This should target ES2017, and additionally include the types just for bigint.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried this but get following error when optimization is enabled for the build ERROR: Big integer literals are not available in the configured target environment ("es2017")
0

Try to build the app after adding this browserslint config in the package.json.

For key production add the supports bigint value in the list.

"browserslist": {
    "production": [
      "supports bigint",
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.