You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is similar or related to #2031 and #2023 but not sure.
Expected Behavior
When running mocha and pulling in modules from between packages they should resolve and be found when a test runs.
Actual Behavior
When a test script runs a function that itself imports a variable (or anything) from a another package in the monorepo, the variable is not resolved.
Error: Cannot find package 'packages' imported from C:\Users\AliceHerbison\import-error\packages\extra1\functions\exampleFunction.ts
at packageResolve (C:\Users\AliceHerbison\import-error\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:757:9)
at moduleResolve (C:\Users\AliceHerbison\import-error\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:798:18)
at Object.defaultResolve (C:\Users\AliceHerbison\import-error\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:912:11)
at C:\Users\AliceHerbison\import-error\node_modules\ts-node\src\esm.ts:218:35
at entrypointFallback (C:\Users\AliceHerbison\import-error\node_modules\ts-node\src\esm.ts:168:34)
at C:\Users\AliceHerbison\import-error\node_modules\ts-node\src\esm.ts:217:14
at addShortCircuitFlag (C:\Users\AliceHerbison\import-error\node_modules\ts-node\src\esm.ts:409:21)
at resolve (C:\Users\AliceHerbison\import-error\node_modules\ts-node\src\esm.ts:197:12)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36)
Steps to reproduce the problem
yarn
yarn test
Minimal reproduction
This is a minimal reproduction using the same setup and folder structure for our corporate monorepo. The example functions and tests are basic but illustrate exactly the same concept - https://github.com/alicegherbison/import-error
This is my first issue raised here - can provide more details if needed. Any help is much appreciated, as have tried what feels like every solution regarding tsconfig-paths/register, path mapping etc to no avail.
The text was updated successfully, but these errors were encountered:
E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:757
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base));
^
CustomError: Cannot find package 'fs' imported from E:\Dev\package.json
at packageResolve (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:757:9)
at resolvePackageTargetString (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:424:16)
at resolvePackageTarget (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:464:12)
at resolvePackageTarget (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:510:26)
at packageImportsResolve (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:620:26)
at moduleResolve (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:793:21)
at Object.defaultResolve (E:\Dev\node_modules\ts-node\dist-raw\node-internal-modules-esm-resolve.js:912:11)
at E:\Dev\node_modules\ts-node\src\esm.ts:218:35
at entrypointFallback (E:\Dev\node_modules\ts-node\src\esm.ts:168:34)
at E:\Dev\node_modules\ts-node\src\esm.ts:217:14
[nodemon] app crashed - waiting for file changes before starting...
error will appear.
When I change the value of node under imports #fs to ./src/fs.ts , it works normally. I think maybe ts-node cannot parse the node built-in module in Subpath imports.
Search Terms
I think this is similar or related to #2031 and #2023 but not sure.
Expected Behavior
When running mocha and pulling in modules from between packages they should resolve and be found when a test runs.
Actual Behavior
When a test script runs a function that itself imports a variable (or anything) from a another package in the monorepo, the variable is not resolved.
Steps to reproduce the problem
Minimal reproduction
This is a minimal reproduction using the same setup and folder structure for our corporate monorepo. The example functions and tests are basic but illustrate exactly the same concept - https://github.com/alicegherbison/import-error
Specifications
This is my first issue raised here - can provide more details if needed. Any help is much appreciated, as have tried what feels like every solution regarding tsconfig-paths/register, path mapping etc to no avail.
The text was updated successfully, but these errors were encountered: