I have a problem with React webb application on IOS 16.3 and lower version. I discovered that my compile crete static class methods that not supported in ES5, that course syntax problems (SyntaxError: Unexpected token { )
The problem is that i need to webpack + babel + tsconfig. (I used nx before and hasnt such problem with project src code)
webpack.config.js
{
test: /\.(ts|tsx|js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
}
babel.config.json
{
"babelrcRoots": ["*"],
"plugins": [
"@babel/plugin-transform-typescript",
"@babel/plugin-transform-class-static-block",
"@babel/plugin-syntax-async-generators"
],
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": "> 2.5%, not dead",
"useBuiltIns": "usage",
"forceAllTransforms": true,
"corejs": 3,
"debug": true
}
],
"@babel/preset-react",
"@babel/preset-typescript"
]
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "es5", "es2015.promise"],
"strict": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"sourceMap": true,
"resolveJsonModule": true
},
"include": ["src", "images.d.ts"],
"exclude": ["public", "node_modules"]
}
I tried a lot of files combination but, still see non ES5 syntaxis in compiled file
Why target in ts config do not work correctly