DateTime npm extension errors on import with Vite 4
DateTime npm extension errors on import with Vite 4
Link to test case: https://stackblitz.com/edit/datatables-net-vue3-simple-znwa2j?file=src/App.vue
Debugger code (debug.datatables.net): N/A
Error messages shown:
✘ [ERROR] Cannot assign to import "$"
node_modules/datatables.net-datetime/dist/dataTables.dateTime.mjs:1633:2:
1633 │ $ = jq;
╵ ^
Imports are immutable in JavaScript. To modify the value of this import, you must export a setter function in the imported file (e.g. "set$") and then import and call that function here instead.
Description of problem:
Currently am using the Vue 3 Datatables component and am trying to import the DateTime extension for use with the Search Builder. Importing the datatables.net-datetime npm package with vite set to version ^4 results in the error above. I can confirm this also occurs with Vite version 3, ~~but works fine with ^2.9.12 (^2.9.12 is the Vite version currently being used in all of the Vue 3 component StackBlitz examples in the docs)~~ (edit: i tried this version again and it didn't work so I'm crossing this out) I appreciate any help with this.
This question has an accepted answers - jump to answer
Answers
Thanks for pointing that out! I've just committed a fix and release DateTime 1.4.1 which will address the issue.
Regards,
Allan
Thank you so much!