When I build my package with the default npm datetimepicker modules from the npm package repo everything works fine. But if I try to build with a local version, I ended with an error when I load the page saying that. I downloaded the local package from git hub.
Uncaught TypeError: eo.datetimepicker is not a function
Both my code and the datetimepicker have dependency on jquery (not sure if that's relevant).
The problem remains even if the datetimepicker package is identical to what npm gets from the repo ( I checkout the version that's in the npm repo)
For example, this works:
npm install
npm run build
But this doesn't
npm install --save ../../datetimepicker
npm run build
I can see that in node_modules, a link is created for the jquery-datetimepicker module that points to the ../../datetimepicker folder where I cloned the repo.
In my code:
"use strict";
import 'bootstrap';
import 'bootstrap-toggle';
import '<package name>'
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-toggle/css/bootstrap-toggle.min.css'
import 'jquery-datetimepicker/jquery.datetimepicker.css'
My webpack config file:
module.exports = {
output: {
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
};