Project scenario:
The company’s official website project built with Vue scaffold
Problem Description:
async/await
is used when processing asynchrony. It is found that the console reports an error regeneratorruntime is not defined
Cause analysis:
The project uses Babel, and Babel needs some auxiliary functions when translating ES6 syntax. When there is no module to encapsulate these auxiliary functions, it will report similar not defined.
Regeneratorruntime is an auxiliary function generated by Babel for async/await compatible syntax. Regenerator runtime is not defined. Obviously, the package of regenerator runtime is missing.
Solution:
-
- install transform runtime
yarn add @babel/plugin-transform-runtime -D
Configure Babel (I use Babel 7.0 as Babel.Config.JS)
plugins: [
[
"@babel/plugin-transform-runtime"
]
]
Restart the service and find that there is no error when running
Read More:
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- [Solved] vite2+vue3 jsx Error: React is not defined
- vue eslint error ‘process‘ is not defined no-undef [How to Solve]
- How to Solve “Vue is not defined” Error
- Ant design vue table Error: h is not defined [How to Solve]
- [Solved] Vue3 process Error: Uncaught ReferenceError: process is not defined
- [Solved] Vue item packaging error: Failed to load resource: the server responded with a status of 404 (Not Found)
- vue error: ‘ev’ is defined but never used (no-unused-vars)
- [Solved] Vue Error: error ‘xxx‘ is defined but never used no-unused-vars
- [Solved] Vue Error: template or render function not defined
- [Solved] vite package Error: globalThis is not defined
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- Vue item packaging error: errno 134 [How to Solve]
- [Solved] Vue Error: Uncaught TypeError: Vue.createApp is not a function
- [Solved] Vue Error: error: ‘to‘ is defined but never used (no-unused-vars)
- [Solved] JQuery each Method Error: $XXX is not defined
- [Solved] Vuepress Package Error: document is not defined
- [Solved] Uncaught ReferenceError: axios is not defined
- Vuepress build error: window is not defined [How to Solve]
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined