Error [ERR_REQUIRE_ESM]: Must use import to load ES Module (v2.15.0)


  • nuxt: v2.15.0
  • node: v12.16.1


importing an esm inside your nuxt.config.js.

import Test  from './assets/js/test.mjs';
module.exports = {



export class Test {
  constructor() {}
export default Test;

Steps to reproduce

  1. set up your nuxt.config.js like above
  2. run nuxt build

What is Expected?

Not to fail

What is actually happening?

Seems you removed “jakejs” and that change or maybe something else caused a bunch of problems regarding dependencies. Everything was working just fine in v2.14.6

2 thoughts on “Error [ERR_REQUIRE_ESM]: Must use import to load ES Module (v2.15.0)

  1. Hi. Pardon me for late response. Issue with .mjs extension is fixed in jiti@1.5.0. Best way to get update is to recreate yarn.lock/package.lock.json