Fork me on GitHub

I'm feeling lazy and didn't search for longer than 3 minutes:


Can I import NPM or node modules via Planck?


@tbaldridge No… Planck is based on plain JavaScriptCore and doesn’t have support for js/require. You should be able to do this in Lumo, though. It is actually based on Node.


thanks for the info!


No problem. At times I’ve thought about implementing it in Planck. I haven’t done any research to see how much would be involved.


I suppose the real killer would be, even if Planck could successfully load some JavaScript properly via js/require, then that JavaScript might expect other Node capabilities to be available in the ambient environment, like the filesystem and process stuff. The Node API would be a huge thing to replicate.


I guess planck could easily run compiled node moules, or import CommonJs files?


But yeh, as soon as a module requires fs/url or what have you, id would fail I guess.


Yeah, it looks like implementing Node's module system might not be out of reach. That would let Planck successfully load things like


I was patching the require for a pr for lumo, didn't seem super complicated the logic here


if it's just compiling index.js in commonjs (main from package.json) into cljs environment it's not, but as soon as it's useing node binaries or something fancy, it gets quickly hard I guess.