You’ll want to look at the @11ty.dev file passthrough API www.11ty.dev/docs/copy/ This is how I bring my node_module files through to my build. Not the most elegant, but the path of least resistance
You’ll want to look at the @11ty.dev file passthrough API www.11ty.dev/docs/copy/ This is how I bring my node_module files through to my build. Not the most elegant, but the path of least resistance
Thank you. I had a similar thought. Though the lack of elegance had me hoping somebody had already found a smarter solution. bsky.app/profile/g12n...
bsky.app/profile/11ty... might be an improvement on that (and a nod to yet another improvement there too)
What would smarter look like?
Good question. Maybe a collector that rewrites and copies esm imports into a folder (maybe even downloads remote ones) automatically. Similar to how eleventy-image does it. Though that would be again a very build-centric solution. 😬
Though it wouldn't have to rewrite the codes if it generated the appropriate import map for the projects npm modules. bsky.app/profile/dutc...
I guess what you could do is create a json file that is your import map, consume it with eleventy to pass through the files and then insert it into a script tag as your import map 🤔
I will look into it.
Only drawback to this, at least with my web components, is that there’s nothing to really import. My component scripts are self initiating. I have considered employing @zachleat.com’s approach to allowing both use cases:
Well. We can’t really expect every author to stick to one pattern. So basically a way to collect the JS files and drop them into a folder is what we look for. Damn. How did we do that in jquery times?
It’s nice to provide both routes, dropping the script tag in and away you go or fancy importing