-
-
Save onixus74/9dbd62cb462789732fb490128afe7071 to your computer and use it in GitHub Desktop.
DataTables.net with webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here's how to make jQuery DataTables work with npm and webpack. This is the simplest way I found to do it. | |
See the previous revision of this gist for a way to do it with forcing AMD to be disabled if you need that. | |
Install DT core: npm install datatables.net | |
Install a DT style: npm install datatables.net-dt | |
Then to initialize DT in your app, do this in your main entry point: | |
// you can use import or require | |
import dt from 'datatables.net'; | |
import 'datatables.net-dt/css/jquery.datatables.css'; | |
Now you can use .DataTable(): | |
$('table[data-table]').DataTable(); // or whatever you want |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment