[Vuejs]-Why would `import dataTables from 'datatables.net'` work on some machines but not others?

1👍

That error means there is no $.fn.dataTable object.

Post your webpack mix file and how you’re using jQuery. I’m suspecting that external/multiple jQuery conflict here, where you import one jQuery and the DataTable is initialized on a different jQuery. See if this work.

// Right below your imports, initialize everything you imported
// this make sure fn.dataTable get initialized on the imported jQuery
// which is reference as $ in this case
dataTables(window, $);
dataTablesSelect(window, $);
dataTablesColReorder(window, $);
dataTablesScroller(window, $);

Shameless plug, check out my wrapper here – https://github.com/niiknow/vue-datatables-net – it may help make things easier for you. Even with my wrapper, you have to still know which jQuery you’re initializing it on.

👤Noogen

Leave a comment