mxmvshnvsk/i18n-unused

Import from esm module not working

Opened this issue · 0 comments

I'm trying to use generateFilesPaths in esm module.

import {generateFilesPaths} from 'i18n-unused'

But it raises ERR_MODULE_NOT_FOUND.

node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '<PROJECT_PATH>/node_modules/i18n-unused/dist/i18n-unused.js' imported from <PROJECT_PATH>/src/myscript.js
Did you mean to import i18n-unused/dist/i18n-unused.cjs?
    at new NodeError (node:internal/errors:387:5)
    at finalizeResolution (node:internal/modules/esm/resolve:429:11)
    at moduleResolve (node:internal/modules/esm/resolve:1006:10)
    at defaultResolve (node:internal/modules/esm/resolve:1214:11)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}
  • node version v16.17.0
  • yarn version 1.22.19
  • simplest package.json
{
...
  "type": "module",
  "dependencies": {
    "flat": "^5.0.2",
    "i18n-unused": "0.13.0"
  },
}

Am I doing anything wrong?