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 originally thought that the issue might have had something to do with using dynamic imports, so I tried to statically import the library using the following patch:
patch to src/util/fs.ts
diff --git a/src/util/fs.ts b/src/util/fs.ts
index 0e09e7c..3b5022f 100644
--- a/src/util/fs.ts
+++ b/src/util/fs.ts
@@ -1,6 +1,7 @@
import {Stats, existsSync as fsExistsSync, readFileSync} from 'node:fs'
import {readFile, stat} from 'node:fs/promises'
import {join} from 'node:path'
+import {parse as tsparse} from 'tsconfck'
import {mergeNestedObjects} from './util'
@@ -73,8 +74,7 @@ export function existsSync(path: string): boolean {
}
export async function readTSConfig(path: string) {
- const {parse} = await import('tsconfck')
- const result = await parse(path)
+ const result = await tsparse(path)
const tsNodeOpts = mergeNestedObjects(result.extended ?? [result], 'tsconfig.ts-node')
return {...result.tsconfig, 'ts-node': tsNodeOpts}
}
When trying to build the project, it gave the following error: Cannot find module 'tsconfck' or its corresponding type declarations..
Full `yarn pack` output
$ yarn pack
yarn pack v1.22.21
$ yarn run build
yarn run v1.22.21
$ shx rm -rf lib && tsc
src/util/fs.ts:4:32 - error TS2307: Cannot find module 'tsconfck' or its corresponding type declarations.
4 import {parse as tsparse} from 'tsconfck'
~~~~~~~~~~
Found 1 error in src/util/fs.ts:4
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/pack for documentation about this command.
Presumably this inability to resolve the module is also occurring when we try to do the dynamic import in the original code.
To Reproduce
Steps to reproduce the behavior:
Variant 1:
Apply the patch provided above to the repo.
Run yarn pack
Variant 2:
Run npx ts-node in a clone of oclif/core after having run yarn install --frozen-lockfile.
Sanity test by running import {basename, dirname, join} from 'node:path' to see that you can import modules.
Run import {parse} from 'tsconfck' and see it error out.
ts-node output
$ npx ts-node
> import {basename, dirname, join} from 'node:path'
undefined
> import {parse} from 'tsconfck'
<repl>.ts:5:21 - error TS2307: Cannot find module 'tsconfck' or its corresponding type declarations.
5 import {parse} from 'tsconfck'
Expected behavior
The library should be able to be found.
Environment (please complete the following information):
OS & version: MacOS Venture 13.6.3
Shell/terminal & version: bash-5.2.21
Node version: 18.18.2
Yarn version: 1.22.21
Additional context
Looks like folks are having other problems with tsconfck as well: #878.
@Amndeep7 Do you have any logs or stack traces that the indicate the dynamic import of tsconfck is the issue? I'm leaning towards this being specific to jest and/or your testing setup
Regardless, we're working on removing the tsconfck dependency so this may not be an issue for you anymore in a couple of weeks
@mdonnalley I believe the issue is with trying to import tsconfck at all. It fails during both static and dynamic imports as detailed above. In any case, it being removed as a dependency should ideally resolve the issue.
Describe the bug
tsconfck
as a module cannot be found for some reason.Originally discovered when this workflow started failing in one of our repos: https://github.com/mitre/saf_action/actions/runs/7285825454/job/19853410684. The specific issue there was that jest started segfaulting. Tracing the code showed that the crash occurred when trying to dynamically import
tsconfck
here.I originally thought that the issue might have had something to do with using dynamic imports, so I tried to statically import the library using the following patch:
patch to src/util/fs.ts
When trying to build the project, it gave the following error:
Cannot find module 'tsconfck' or its corresponding type declarations.
.Full `yarn pack` output
Presumably this inability to resolve the module is also occurring when we try to do the dynamic import in the original code.
To Reproduce
Steps to reproduce the behavior:
Variant 1:
yarn pack
Variant 2:
npx ts-node
in a clone of oclif/core after having runyarn install --frozen-lockfile
.import {basename, dirname, join} from 'node:path'
to see that you can import modules.import {parse} from 'tsconfck'
and see it error out.ts-node output
Expected behavior
The library should be able to be found.
Environment (please complete the following information):
Additional context
Looks like folks are having other problems with tsconfck as well: #878.
Looks like tsconfck removed support for cjs exports: https://github.com/dominikg/tsconfck/releases/tag/tsconfck%403.0.0
The text was updated successfully, but these errors were encountered: