kerimdzhanov / dotenv-flow

Loads environment variables from .env.[development|test|production][.local] files for Node.js® projects.
MIT License
862 stars 35 forks source link

npx mocha -r dotenv-flow/config --recursive app not working on 4.0.0 but was fine on 3.2.0 #81

Closed sombriks closed 1 year ago

sombriks commented 1 year ago

Hello, for some reason preload stopped working when i upgraded dotenv-flow from 3.2 to 4.0

i am running it on node 18, as long as i keep 3.2 things works fine.

Here's a sample error when running with 4.0:

[sombriks@lucien market-forecast]$ npx mocha -r dotenv-flow/config --recursive app

✖ ERROR: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './config' is not defined by "exports" in /home/sombriks/git/market-forecast/node_modules/dotenv-flow/package.json imported from /home/sombriks/git/market-forecast/node_modules/mocha/lib/nodejs/esm-utils.js
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:362:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:642:13)
    at packageResolve (node:internal/modules/esm/resolve:873:14)
    at moduleResolve (node:internal/modules/esm/resolve:939:20)
    at defaultResolve (node:internal/modules/esm/resolve:1132:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:524:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1188:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:429:21)
    at importModuleDynamically (node:internal/vm:106:46)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:36:14)
    at exports.doImport (/home/sombriks/git/market-forecast/node_modules/mocha/lib/nodejs/esm-utils.js:35:34)
    at formattedImport (/home/sombriks/git/market-forecast/node_modules/mocha/lib/nodejs/esm-utils.js:32:18)
    at exports.requireOrImport (/home/sombriks/git/market-forecast/node_modules/mocha/lib/nodejs/esm-utils.js:42:34)
    at exports.handleRequires (/home/sombriks/git/market-forecast/node_modules/mocha/lib/cli/run-helpers.js:94:34)
    at async /home/sombriks/git/market-forecast/node_modules/mocha/lib/cli/run.js:349:25 {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
kerimdzhanov commented 1 year ago

Thanks for reporting @sombriks! 👍