Babel is a JavaScript compiler
우선 필요한 패키지를 설정해보겠습니다.
npm i -D @babel/core @babel/plugin-proposal-optional-chaining @babel/preset-env @babel/preset-react @babel/preset-typescript babel-loader
@babel/preset-env
@babel/preset-react, @babel/preset-typescript
babel.config.js
module.exports = (api) => {
api.cache(true);
const presets = [
[
'@babel/preset-env',
{
targets: '> 0.25%, not dead',
useBuiltIns: 'usage',
corejs: 3,
shippedProposals: true,
modules: false,
},
],
'@babel/preset-typescript',
'@babel/preset-react',
];
const plugins = ['@babel/plugin-proposal-optional-chaining'];
return {
presets,
plugins,
};
};