natemoo-re / microsite

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

Home Page:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preact import regex matches too much

ratorx opened this issue · comments

The preact import regex here matches too much. I’m guessing the desired behaviour is the match preact imports. However it also matches other imports that happen to contain preact in them (e.g. import {MDXProvider} from “@mdx-js/preact”, which is a completely different module that happens to contain preact in the name)

I think it’s a fairly easy fix? I think that just adding a single to the regex before preact would avoid this? I’m unsure since this is the first time I’m using preact, so I don’t know exactly what import names the project uses. Assuming it’s just “preact”, this should fix it.

I think a bit of debug info around the transforms in general would be quite helpful. This was fairly annoying to debug because it ended up causing an import error after all the imports from the 2 separate modules were joined into 1 statement import {h, ..., MDXProvider} from “preact”, but I’m not sure how you could achieve this, so I’ll just leave the idea here.

Thanks for opening an issue! Sorry about this one. Tests are the next big priority to catch issues like this.

I'm also working on a built-in MDX integration, just FYI.

Ahh no worries - built in MDX sounds great! I've actually been having some trouble making it work with the plugin (currently I've managed to get build to work, but not dev).

Do you need any help with testing the built-in MDX/is there any way I can clone something and have a play around with it?

ezoic increase your site revenue