-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Vite: Default import yields more than default export #180
Comments
The issue is, that nuxt vite automatically adds some default exports but does not consider named default exports. I described the issue here: |
[email protected] is only exporting a cjs file in umd format. You need to report it to upstream for native esm support. Here is a proper workaround usage for Vue2/Bridge: import VueTailwind from "vue-tailwind";
import Vue from "vue";
import { TInput } from "vue-tailwind/dist/components";
const VueTailwindPlugin =
// @ts-ignore
VueTailwind.default?.default || VueTailwind.default || VueTailwind;
Vue.use(VueTailwindPlugin, {
"t-input": {
component: TInput,
props: {
classes: "border-2 block w-full rounded text-gray-800"
// ...More settings
}
}
});
export default {}; Note that BTW it seems the upcoming version is being rebranded to |
Thanks a lot, this worked nicely. Maybe its worthwhile to add this strategy/workaround to the documentation, as I guess there are quite a few libraries that are not yet supporting esm. By the way, I took the |
Good idea for adding de-default workarounds to esm troubleshoot👍
Indeed. Docs are following vue3/nuxt3 best practices. We probably need to add some notes to the bridge section about installing vue2 plugins or make |
Okay, follow up at nuxt/nuxt#12825 and nuxt/framework#2036. |
Environment
Linux
v14.18.1
2.16.0-27285136.ab1c6cb4
[email protected]
Webpack
plugins
,bridge
,target
,ssr
,buildModules
-
@nuxt/[email protected]
Reproduction
https://codesandbox.io/s/strange-tree-9fdkz
Describe the bug
VueTailwind defines
With
bridge.vite = true
the importimport VueTailwind from "vue-tailwind"
(in a plugin) yields the objectinstead of the default plugin
{ install: ... }
. With disabledvite
everything works as expected.As with webpack everything is fine, I suspect there is a problem with bridge instead of with the library VueTailwind.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: