JQuery Plugin (datatables) with Webpack and Typescript
Disabling AMD seems to be the answer. Many of the solutions I found weren't working for me.
The simplest way to disable AMD is to add the following rule to your webpack config(webpack 2+)
module: {
rules: [
{ parser: { amd: false } }
]
}
You are almost there!
Make sure both datatables.net
and datatables.net-dt
installed via NPM:
npm install datatables.net datatables.net-dt --save-dev
in your entry file ./src/main.js
write:
require( 'datatables.net' )( window, $ )
require( 'datatables.net-dt' )( window, $ )
after that, any code logic of following format $(...).DataTable
will work as the examples shown on the DataTables' homepage.