Do I need to import core-js/stable and regenerator-runtime/runtime when using @babel/preset-env with useBuiltIns:'usage'?
Asked Answered
C

2

16

I use babel 7.8.3 together with @babel/preset-env, useBuiltIns: 'usage' and corejs: 3. The documentation for @babel/preset-env is not clear to me.

Do I need to add the following lines at the top of my entry file or is it done automatically by babel?

import 'core-js/stable';
import 'regenerator-runtime/runtime';
Choragus answered 20/1, 2020 at 11:54 Comment(0)
S
2

Don't need to add import code by yourself when use usage.

And no more need to manually include the regenerator-runtime helper when compiling generators after babel/core >= 7.18

Susian answered 27/5, 2022 at 2:6 Comment(0)
E
0

According to babel-preset-env docs you should import those modules by yourself

Epirus answered 19/2, 2020 at 0:40 Comment(1)
I'm sorry. I made a typo in the description. I meant useBuiltIns: 'usage' not useBuiltIns: 'entry'Choragus

© 2022 - 2024 — McMap. All rights reserved.