Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested node_modules generated under esm/script which breaks module resolution #306

Open
LiamAttClarke opened this issue May 25, 2023 · 2 comments

Comments

@LiamAttClarke
Copy link

LiamAttClarke commented May 25, 2023

Issue

dnt is outputting dependencies under npm/esm/node_modules and npm/script/node_modules in addition to the root npm/node_modules. The nested node_modules only contain an incomplete set of files from the ya-svg-transform package which is installed correctly in the root node_modules folder.

This results in the tests failing with the following error:
image

Temporary Workaround

I found that deleting the extra node_modules directories resolved the issue so I added the following to my postBuild hook:
build_npm.ts

...
await build({
  postBuild() {
    ...
    // Delete unwanted node_modules outputs
    // Deno.removeSync("npm/esm/node_modules", { recursive: true });
    // Deno.removeSync("npm/script/node_modules", { recursive: true });
  },
});

Notes

Not sure why these extra files are being emitted but it seems to me it may be an issue with the ts-morph package.

@dsherret
Copy link
Member

Could you provide a reproduction? Do you by chance have a node_modules directory in your main directory?

@LiamAttClarke
Copy link
Author

Hey @dsherret, sorry for the late response.

I setup a minimal reproduction here.

I also confirmed that I had no stray node_modules directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants