1. 등장배경
- babel을 통해 ES6문법을 ES5 환경에서 동작이 가능하게 변환해주지만 없는 ES6 메서드 등을 지원하지 못해 이를 지원하기 위해 polyfill 등장
- 하지만 babel 7.4.0부터 deprecated
- 해결방안: core-js와 regenerator-runtime을 직접 사용
- webpack 번들에 포함하여 내부에 기입 -> 전역 오염이 안 되어 가장 적합
2. 설치
npm install --save-dev @babel/plugin-transform-runtime npm install --save @babel/runtime @babel/runtime-corejs3
3. 사용
dali2-test /.babelrc { "plugins": [ [ "@babel/plugin-transform-runtime", { "corejs": 3 } ] ] }
📃 참고자료
- https://tech.kakao.com/2020/12/01/frontend-growth-02/ [카카오 테크: Polyfill]
- https://babeljs.io/docs/en/babel-polyfill [Babel 문서]
- https://github.com/zloirock/core-js [core.js]
- https://babeljs.io/docs/en/babel-plugin-transform-runtime [plugin-transform-runtime]