Last active
June 12, 2024 03:23
-
-
Save jrunestone/2fbe5d6d5e425b7c046168b6d6e74e95 to your computer and use it in GitHub Desktop.
Revisions
-
Johan Johansson revised this gist
May 17, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first which breaks when you're using CommonJS with webpack. Install DT core: npm install datatables.net Install a DT style: npm install datatables.net-bs (bootstrap) -
Johan Johansson revised this gist
May 17, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first which breaks everything when you're using CommonJS. Install DT core: npm install datatables.net Install a DT style: npm install datatables.net-bs (bootstrap) -
Johan Johansson created this gist
May 17, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first which breaks everything. Install DT core: npm install datatables.net Install a DT style: npm install datatables.net-bs (bootstrap) Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd Create a loader "exception" just for DT in webpack.config.js: module: { loaders: [ { test: /datatables\.net.*/, loader: 'imports?define=>false' } ] } Then to initialize DT in your app, do this in your main entry point: // you can use import or require import 'datatables.net'; import dt from 'datatables.net-bs'; dt(window, $); Now you can use .DataTable(): $('table[data-table]').DataTable(); // or whatever you want