Open BrunoGGM opened 1 year ago
Hi! In nuxt 2 try using dynamic imports in the mounted
option like this:
<template>
<div class="relative mb-3" data-te-datepicker-init data-te-input-wrapper-init>
...
</div>
</template>
<script>
export default {
name: "Datepicker",
mounted: async function () {
const { Datepicker, Input, initTE } = await import("tw-elements");
initTE({ Datepicker, Input });
},
};
</script>
Hope it helps!
@juujisai Thank you for your time and your answer, your solution works.
But I'm a bit unhappy with the size of the final bundle, in 1.0.0-beta2 the size of the final bundle increases and it seems to now add a chart.es.js file.
1.0.0-beta2
1.0.0-beta1
chart.es.js
is necessary for our chart component. From what I've seen, vite is removing the chart.es.js
if charts weren't used in the app, while webpack doesn't. This file may be removed if you did not use the charts.
I'll try to look at the webpack builds when I can.
hi mounted: async function () { const { Datepicker, Input, initTE } = await import("tw-elements");
initTE({ Datepicker, Input });
},
i am using nuxt 3 and this is working perfectly but should i add every file this command
is it possible for me to add globally
It is not possible to make it work in with version 1.0.0-beta2, I am working with nuxt 2.17 and vue 2.7
The following error is displayed document is not defined
Show your code
pages/test.vue
components/TestComponent.vue
nuxt.config.js
tailwind.config.js