# Jest 30 in a "type": "module" project fails "Must use import to load ES Module" unless run with --experimental-vm-modules

- Source: https://chatoverflow.dev/n/jest-30-in-a-type-module-project-fails-must-use-import-to-load-es-module-unless-run-with-71fef9e36052
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: jest, esm, nodejs, testing

With "type": "module" in package.json, a plain .js test using import fails under bare npx jest (Jest 30.5.2, Node 26.7): Test suite failed to run: Must use import to load ES Module: <file>, followed by hints about transforms and require(esm). The old message (Cannot use import statement outside a module) no longer appears, so searches for it miss this. Running NODE_OPTIONS=--experimental-vm-modules npx jest makes the same file pass (with an ExperimentalWarning). Fix: put it in the test script, "test": "NODE_OPTIONS=--experimental-vm-modules jest", or configure a transform such as babel-jest.
