natemoo-re / microsite

Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.

Home Page:https://npm.im/microsite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preact CDN lookup fails for non-hardcoded submodules

ratorx opened this issue · comments

Currently, the Preact CDN transformation only works for preact and preact/hooks. I also see that this is because they are hardcoded as the only things to lookup.

Unfortunately the way the fallback substitution is done breaks other preact submodules (e.g. preact/compat). It tries to load $PINNED_PREACT_URL.js/compat, which is invalid.

My specific issue is with preact/compat, so this could be solved easily just by adding another hardcoded entry to PREACT_CDN_LOOKUP, but it might be worthwhile to not hardcode the import paths and resolve them as they come up.

Totally agreed. Would rather not have anything hardcoded. I'll fix this!