Solvedtempus dominus datetimepicker() is not a function

I am using the npm install method to use this package with an app I am building and no matter where I seem to put it, I receive the dreaded undefined error in my console:

Uncaught TypeError: $(...).datetimepicker is not a function

Here is my simplified JavaScript file:

window.$ = window.jQuery = require("jquery");
require('eonasdan-bootstrap-datetimepicker');

$( document ).ready(function() {
    $('.datepicker').datetimepicker();
});

Am I missing something fundamental here? This seems like the simplest possible use case.

Thanks!

24 Answers

✔️Accepted Answer

This worked for me using Webpack without additional configuration:

global.$ = global.jQuery = require('jquery');
$.fn.datetimepicker = require('eonasdan-bootstrap-datetimepicker');

Not really pretty solution but at least you don't have to waste time on configuration.

More Issues: