A
A
Alexander2021-10-18 20:31:50
typescript
Alexander, 2021-10-18 20:31:50

VUE JS 3. How to transpile chunk-vendors to ES5?

vue 3 + typescript project.
An error occurs in the webOS emulator:
Uncaught SyntaxError: Use of const in strict mode.

As I understand it, the runtime (browser) does not support ES6+ syntax.
The error occurs in the chunk-vendors file, but in some dependencies the ES6+ code.

tsconfig piece:

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2020",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },


Added vue.config.js, add dependencies in array to transpileDependencies
module.exports = {
   transpileDependencies: [зависимости]
}


But nothing changes at the output.
As there were const, arrow functions, etc., they remain.
Tell me how to make it so that chunk-vendors has ES5?
Thanks for the help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
m15hgun, 2021-10-19
@m15hgun

Try specifying browserslist, for example in package.json:

"browserslist": [
  "Chrome 38"
]

Documentation: https://cli.vuejs.org/guide/browser-compatibility.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question