-
Notifications
You must be signed in to change notification settings - Fork 0
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
Build error: Message SKD uses node specific import #4
Comments
@nils.jacobsen this is a lix issue no? |
move this issue to lix-sdk? |
The typescript compiler likely detects the node import and throws. A quick-fix could be to trick the typescript compiler. @jan.johannes @nils.jacobsen can you try this fix below in the lix sdk code? -await import("node:crypto")
+await import("no" + "de" + ":crypto") |
resolved by using esbuild --external configuration. cause was building for browser with esbuild but esbuild had no way to know the dynamic import will never be active in browser environment |
Thanks @jan.johannes gonna fix it. |
@jan.johannes why not use the hack i proposed? it seems like your |
@samuelstroschein the hack does not work and this is the official esbuild solution. the only reason this is a problem is because tree shaking is still broken in our build, by the time we let lix be used by other apps this needs to be solved anyways. |
@nils.jacobsen @samuel.stroschein actually i just found a much better solution. the --external will be obsolete after the next lix release node exposes the module as globalThis.crypto too |
@jan.johannes sounds like a one line code change. why not do it now? |
@samuelstroschein because it breaks tests for some reason, i need to find out why it works everywhere except in github actions :D |
ok so the globalThis was introduced in node 12 but only in node 19 do we get the crypto there. so for node 18 it only works with a command line flag. i moved to using the old method. but added a string interpolation into the dynamic import to try pushing esbuild into treating it as external. (i think thats what you meant by "no" + "de", but that does not work, ``node:${variable} |
>(i think thats what you meant by "no" + "de", but that does not work, ``node:${variable} Yes that's what i meant. I thought interpolation wouldn't be needed to achieve this but had in mind |
@samuel.stroschein anything should work as long as there is a variable added to a string in the process |
When types get imported via
@inlang/sdk
in the settings component, it can't get build anymore, because it's not build for"--platform=node"
.The problem origined on the lix side: with the
hash.js
file.The text was updated successfully, but these errors were encountered: