We are using CommonJS modules for small CLI applications, and previous version of this library worked flawlessly. Upgrading to 12.0.2 broke our tool, so we ended up downgrading to 11.0.4. We are trying to import globby with the following code:
const globby = require("globby");
It produces the following error message:
C:\work\ivm\savelog-smart\.yarn\cache\globby-npm-12.0.2-6be2a4aac6-f474ced866.zip\node_modules\globby\index.js:1
import fs from 'node:fs';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.external_module_.Module._load (C:\work\ivm\savelog-smart\.pnp.cjs:37659:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\work\ivm\savelog-smart\savelog-smart-plugin-api\frontend\build-tools\releaser\version-replace.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Environment
The problem
We are using CommonJS modules for small CLI applications, and previous version of this library worked flawlessly. Upgrading to
12.0.2
broke our tool, so we ended up downgrading to11.0.4
. We are trying to import globby with the following code:It produces the following error message: