eik-lib / rollup-plugin

Rollup plugin to do build-time import mapping using Eik
https://eik.dev
MIT License
2 stars 1 forks source link

Doesn't work for subpaths / subfolders in module #42

Closed lubomirblazekcz closed 2 years ago

lubomirblazekcz commented 3 years ago

Example usage

let language = document.documentElement.lang;
const lang = await import(`vanillajs-datepicker/js/i18n/locales/${language}.js`);

or

const lang = await import(`vanillajs-datepicker/js/i18n/locales/sk.js`);

import is not replaced with url from importmap

"vanillajs-datepicker/": "https://cdn.esm.sh/vanillajs-datepicker@1.1.2/esnext/"

This is important for libs that have plugins, language files or other stuff in subfolders

trygve-lie commented 3 years ago

Thanks for your feedback but one question first; are you running the EIk server or are you just doing a mapping with rollup (I see you are refering to esm.sh)? I am asking because this module builds on rollup-plugin-import-map where this logic is located. This module only loads an Eik config to load import maps from en Eik server. If the later, you should probably just use rollup-plugin-import-map.

Anyhow; this issue has also been reported here https://github.com/trygve-lie/rollup-plugin-import-map/issues/14. I'll take a look at it in the coming days.

lubomirblazekcz commented 3 years ago

Just for mapping with rollup. Thanks for the heads-up about the other repo. Propably better for my use case, but Elk sure looks interesting, gonna give it a try sometime