-
Notifications
You must be signed in to change notification settings - Fork 17
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
Duktape Module Loading Support #55
Comments
Hi @ngmaloney - thanks for using A typescript shard would be really useful and sounds like a fun project! You're definitely correct on your research with regards to modules and the Duktape engine. Duktape 2.X removed the built-in module loading framework and moved the code into an extra that can be introduced into the build. Another compounding factor is that As the global I'd be open to any pull requests that would re-introduce the An alternative approach is that the C module resolver code can be ported to Crystal! This would give users of this shard the ability to "enable" the module resolver when required in Crystal code without having to recompile all of C code for Duktape. This is actually an approach I investigated a while back in the require-node branch. Of course if you have the option to shell out to Finally, if anyone does want to go down the path of writing a Crystal-based module resolver for
TLDR
|
@jessedoyle thank you for the detailed response. My end goal is to create an experimental middleware that bundles ts/js/css assets without any dependencies on Node. I'll do some more research based on the resources mentioned in your reply and see where that takes me. I'll close out this issue, appreciate all your work on this. |
I'm fairly certain that's possible - my response above should help provide some direction for sure. If you find that you need any changes in |
I'm attempting to take a stab at creating a Typescript shard. I'm getting hung up on whether I need the ability to reference
ts
as a module. I'm currently trying something like the following (as a POC)It is returning the following error:
I started poking around the duktape docs and they mention Duktape 2.0 requires the module loading code to be included in the build. I didn't see any reference to
duk_module_duktape
in the duktape.cr source code. I'd be interested in PR'ing a patch but want to make sure this is the correct approach.The text was updated successfully, but these errors were encountered: