question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue template using this.$nextTick results in "[nuxt] [request error] require is not defined in ES module scope..."

See original GitHub issue

Environment

  • Operating System: Darwin
  • Node Version: v17.8.0
  • Nuxt Version: 3.0.0-rc.1
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: vue, head, plugins, components, buildModules, modules, axios, auth, build, styleResources, css, vite, bootstrapVue, loading, loadingIndicator, router, privateRuntimeConfig, publicRuntimeConfig, pwa, hooks
  • Runtime Modules: nuxt-session@1.0.3, cookie-universal-nuxt@2.1.5, bootstrap-vue/nuxt, nuxt-helmet@2.1.1
  • Build Modules: @nuxtjs/eslint-module@3.1.0, @nuxt-hero-icons/outline/nuxt@1.0.1

Reproduction

yarn run dev on a project I am attempting to migrate from Nuxt 2

Describe the bug

Error:

[nuxt] [request error] require is not defined in ES module scope, you can use import instead
  at $id_1ccadb5e (./.nuxt/dist/server/server.mjs:14959:22)

Offending line in server.mjs:

const { nextTick } = require('vue');

The Vue template in question uses this.$nextTick and if I remove the calls to that, the error goes away.

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
antfucommented, Jun 10, 2022

Fix landed in unimport@0.2.7, you may need to update your lockfile to have the latest unimport installed

3reactions
danielroecommented, Jun 11, 2022

You can run yarn upgrade unimport or npm upgrade unimport.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[nuxt] [request error] require is not defined in es module scope ...
The Vue template in question uses this.$nextTick and if I remove the calls to that, the error goes away. Additional context. No response....
Read more >
require is not defined in ES module scope, you can use import ...
The error output is : Requiring external module babel-register ReferenceError: require is not defined in ES module ...
Read more >
Available rules - eslint-plugin-vue
Rule ID Description vue/multi‑word‑component‑names require component names to be always multi‑word... vue/no‑arrow‑functions‑in‑watch disallow using arrow functions to define watcher... vue/no‑computed‑properties‑in‑data disallow accessing computed properties in data...
Read more >
vue-template-compiler | Yarn - Package Manager
For pull requests please see src/platforms/web/entry-compiler.js. This package can be used to pre-compile Vue 2.0 templates into render functions to avoid ...
Read more >
The loading Property - Nuxt
Nuxt uses its own component to show a progress bar between the routes. You can customize it, disable it or create your own...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found