DataTables / Vue

Vue plugin for DataTables
MIT License
62 stars 12 forks source link

Nuxt 3 TypeScript Error window is not defined #22

Closed geofany closed 1 year ago

geofany commented 1 year ago

hello i'm using "nuxt": "^3.5.2" and "datatables.net-vue3": "^2.1.1"

i'm using data tables like this in my components

Screenshot 2023-06-16 at 22 18 51

but it got error when i run the project

Screenshot 2023-06-16 at 22 17 28
AllanJard commented 1 year ago

Can you create a mini repo for me showing the error please?

While you are using ESM style imports, something is converting that back to CommonJS which might be causing the issue.

geofany commented 1 year ago

Can you create a mini repo for me showing the error please?

While you are using ESM style imports, something is converting that back to CommonJS which might be causing the issue.

Sure, here's the repo https://github.com/geofany/nuxt3-datatables

i'm Using Node 18.16.0 and Yarn

MohanadAlrefaai commented 1 year ago

@geofany You can temporary fix the issue by surrounding the component with ClientOnly tag

AllanJard commented 1 year ago

Sorry for the delay in replying here! I had inverted logic in the CommonJS loader when checking for a windowed environment. Doh! Fix committed here.

I'll tag 1.13.6 which will have this fix next week.