$(…).datetimepicker is not a function (Webpack Fix)

Mitch Talmadge
Mitch Talmadge
Published in
1 min readNov 22, 2016

I attempted to install Eonasdan’s Bootstrap DateTimePicker using webpack, but when I tried to use it, I got this error:

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

The problem is that datetimepicker is trying to use its own version of jquery, while the version of jquery used by everything else on the web application was a different version… So the function didn’t exist for the version I was using. The fix is easy — I just added this to the resolve section of my webpack.config.js

alias: {
// Force all modules to use the same jquery version.
'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery')
}

That’s it! (Credit to the folks on this GitHub issue for the fix!)

--

--

Mitch Talmadge
Mitch Talmadge

Facebook Production Engineer Intern • Aspiring Astronaut • Welder • Carpenter • Mechanic • Ham • Friend 😊