Skip to content

Conversation

LEW21
Copy link

@LEW21 LEW21 commented Aug 22, 2024

I'm trying to get deepkit running with Yarn PnP (using deepkit-node - I might send a pull request with that later, when I figure out if it'll actually be usable).

Summary of changes

Right now, running an app (yarn node --import deepkit-node ./app.ts server:start) with FrameworkModule({ debug: true }) in a Yarn PnP environment produces a warning:

Warning: node_modules/@deepkit/framework-debug-gui no build found in /home/linus/dev/my-deepkit-app/.yarn/unplugged/@deepkit-framework-virtual-9069fc273b/node_modules/@deepkit/framework/dist/esm/src/debug

As a result, the debug panel doesn't work. This is because the node_modules path is hardcoded, and there is no node_modules on Yarn PnP.

With this change, it works. I'm using import.meta.resolve to resolve a path to index.html, and I'm forcing yarn to actually unzip ("unplug") the static files, so that it's possible to access them in a traditional way.

As import.meta is accessible only in the ESM mode, I'm doing some hack to do the resolution with require.resolve in CJS mode - I don't really like this solution, but I don't have any idea for a better one. Theoretically, this should be transparently handled by the ESM->CJS transpiler, but TypeScript doesn't support it.

Relinquishment of Rights

Please mark following checkbox to confirm that you relinquish all rights of your changes:

  • I waive and relinquish all rights regarding this changes (including code, text, and images) to Deepkit UG (limited), Germany. This changes (including code, text, and images) are under MIT license without name attribution, copyright notice, and permission notice requirement.

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

Successfully merging this pull request may close these issues.

1 participant