amsul / pickadate.js

The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
http://amsul.ca/pickadate.js
MIT License
7.7k stars 1.02k forks source link

Webpack and pickadate still not working #1212

Closed iammichiel closed 3 years ago

iammichiel commented 4 years ago

Hi there,

I am trying to integrate pickadate in a modern front-end workflow. We are using Webpack and I would like to add this part of the app to that workflow. Everything compiles fine but at runtime, I have : $(...).pickadate is not a function error.

I have tried about everything discussed here and there online :

Related issues : #870 , #775 , #772 #779

So far nothing works.

DanielRuf commented 4 years ago

$(...).pickadate

You have to install jQuery (as devDependency), import / require it and bundle it using the externals config from webpack.

https://webpack.js.org/configuration/externals/

DanielRuf commented 4 years ago

Also please provide a reproducible testcase (as repository) so we can check that if externals does not solve your issue.

jirsbek commented 3 years ago

I can confirm. Using externals option in webpack.config.js works well.

module.exports = {
  //...
  externals: {
    jquery: 'jQuery'
  }
};
DanielRuf commented 3 years ago

Closing as this should be resolved with the correct webpack setup and configuration.