react-template
react-template copied to clipboard
Regenerator runtime problem
Should add new plugin
npm install --save-dev @babel/plugin-transform-runtime
npm install --save @babel/runtime
.babelrc
{
...
"plugins": [
...
["@babel/plugin-transform-runtime"]
],
"sourceType": "unambiguous"
}
https://babeljs.io/docs/en/babel-plugin-transform-runtime#regenerator
[You'll want to set the sourceType option to either "unambiguous" or "script" if your files aren't ES modules. The docs for the option explain, but essentially because the type is wrong, it will insert import statements into your CommonJS file, causing the error you're seeing.](https://github.com/babel/babel/issues/8900#:~:text=You%27ll%20want%20to%20set%20the%20sourceType%20option%20to%20either%20%22unambiguous%22%20or%20%22script%22%20if%20your%20files%20aren%27t%20ES%20modules.%20The%20docs%20for%20the%20option%20explain%2C%20but%20essentially%20because%20the%20type%20is%20wrong%2C%20it%20will%20insert%20import%20statements%20into%20your%20CommonJS%20file%2C%20causing%20the%20error%20you%27re%20seeing.)
Will check
Closed due to ESM usage