astexplorer icon indicating copy to clipboard operation
astexplorer copied to clipboard

Add support for including external scripts/libraries

Open kangax opened this issue 8 years ago • 5 comments

Sometimes I wish I could use lodash when experimenting with a plugin.

kangax avatar Nov 10 '16 23:11 kangax

Maybe we can use https://unpkg.com/ to achieve that?

fkling avatar Nov 10 '16 23:11 fkling

Possibly? What wondering how it would be able to handle pkgs that don't produce a built file and use require though. This was an issue for babel plugins in the repl unless it auto bundles them like in https://wzrd.in/ (browserify as a service)

https://github.com/babel/babel.github.io/issues/858

hzoo avatar Nov 15 '16 13:11 hzoo

You load them from bundle.run which is a Rollup/Browserify as a service with a CDN.

xtuc avatar Aug 29 '17 10:08 xtuc

how exactly do you use bundle.run in astexplorer?

tsiq-swyx avatar Jul 07 '18 02:07 tsiq-swyx

I think this could be easily solved if the plugin/transform gets loaded as esm instead of transforming it to commonjs. Browser already natively support importing from a remote url:

import * as m from "https://esm.sh/@codemod/[email protected]";

j4k0xb avatar Jul 02 '23 17:07 j4k0xb