-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: <default export> is not a function
when using "type": "module"
#11
Comments
|
Oh sure, but hopefully this will change that: vitejs/vite#2157. Not that this means it'll get merged any time soon, but it's in the works™ And I'm not going to argue that this isn't silly, but changing the CJS export to
would get the job done. It's what they do for the react-refresh plugin. |
Ohh I get it now. I was under the impression that the framework preact could not be found during SSR. Wasn't aware that you were referring to the preset itself. We should be able to do something about that. |
Oops, sorry! Could've written that a lot clearer now that I realize how vague that is, and how it also depends on using that as the name for the default import. Totally blanked there, my bad! |
TypeError: preact is not a function
when using "type": "module"
TypeError: <default export> is not a function
when using "type": "module"
Since Vite templates use ESM, there is no reason for this module to stay in CommonJS, or to provide a CJS and ESM interface. This only complicates things. Fixes: preactjs#11. Closes: preactjs#12.
Currently setting up Vite's ESM SSR output when I ran across this.
vite.config.js
I believe always loads externals viarequire()
for the moment. Not sure if that's fixable using plaintsc
, but worst case scenario the CJS exports just need a little rewrite at build time.Side note: Man is that a bizarre way of doing things. You can "use"
import
, but not really.The text was updated successfully, but these errors were encountered: