Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82033

Can't get this to work with NPM and Webpack

$
0
0

I get this error:

jquery.dataTables.js:112 Uncaught TypeError: Cannot set property '$' of undefined
at DataTable (jquery.dataTables.js:112)
at eval (data.js:2)
at Object../js/data.js (data.bundle.js:164)
at webpack_require (data.bundle.js:79)
at checkDeferredModules (data.bundle.js:46)
at data.bundle.js:152
at data.bundle.js:155

Here's my code:

var $ = require('jquery');
var dt = require('datatables.net')();

I've also tried

var $ = require('jquery');
var dt = require('datatables.net')(window, $);

And my package.json dependencies:

"dependencies": {
"datatables.net": "^1.10.19",
"jquery": "^3.3.1"
}

No clue what I'm doing wrong here. I am loading the CSS directly into the page. I'm not loading the CSS via webpack.


Viewing all articles
Browse latest Browse all 82033

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>