"regeneratorRuntime is not defined" error typically occurs when your code uses async/await syntax but doesn't properly include the Babel plugin for regenerator runtime. To fix this error in Vite + Nuxt 3, you can follow these steps:
1. Install additional dependencies:
```bash
npm install --save-dev @babel/plugin-transform-runtime
npm install --save @babel/runtime
```
2. Create a `babel.config.js` file in the root of your project if it doesn't exist, and add the following configuration:
```javascript
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
plugins: [['@babel/plugin-transform-runtime']],
};
```
3. In your Nuxt 3 configuration file (`nuxt.config.js`), make sure to add the following configuration:
```javascript
export default {
// ...
build: {
babel: {
plugins: [['@babel/plugin-transform-runtime']],
},
},
};
```
4. Restart your Vite + Nuxt 3 development server.
This configuration ensures that the Babel plugin for regenerator runtime is properly included, allowing your async/await syntax to work correctly.
Regarding the error appearing only in the desktop mode and not in the mobile mode, it could be due to different transpilation or build setups for different targets. Double-check your build configurations and ensure that the mentioned babel runtime plugin is included consistently across all builds.