'Using jQuery datatables with webpack - Error on new imports-loader version
I am using the latest datatables.net-bs version in a webpack setup (v1.11.5).
To make it work, I had to set the following configuration in my webpack.config.js:
{
test: /datatables\.net.*/,
use: 'imports-loader?define=>false'
}
I am using imports-loader==0.8.0. Unfortunately, this version is about 4 years old and I want to upgrade to the latest one (v3.1.1).
When I do this, I get an error about the changed API:
ValidationError: Invalid options object. Imports Loader has been initialized using an options object that does not match the API schema.
When I remove the configuration part from my webpack-config, I get this error:
Uncaught TypeError: can't access property "$", this is undefined
I tried to use the new imports-loader setup like this:
use: [
{
loader: "imports-loader",
options: {
imports: ["default jquery $"]
}
}
]
Unfortunately, this does not solve my problem.
My question: Does anybody know how to configure imports-loader so I can use the latest version without breaking my datatables?
Thx!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
