Flatpickr: Using plugins in Webpack 3 Enviroment

Created on 10 Aug 2017  路  3Comments  路  Source: flatpickr/flatpickr

Hello

This thing is super awesome, lightweight and not built on top of jQuery , but I have one issue with using Plugins with module bundler such as Webpack 3.

Is there anything other to import besides the flatpicker itself in Webpack enviroment, because when I use something like this:

import Flatpickr from 'flatpickr'

new Flatpickr(domNode, {
  enableTime: true,
  plugins: [new confirmDatePlugin()]
})

It throws me error that confirmDatePlugin is not defined ?

Thanks.

Most helpful comment

You need to import them too.

import confirmDatePlugin from 'flatpickr/dist/plugins/confirmDate/confirmDate' ;

import 'flatpickr/dist/plugins/confirmDate/confirmDate.css' ;

All 3 comments

You need to import them too.

import confirmDatePlugin from 'flatpickr/dist/plugins/confirmDate/confirmDate' ;

import 'flatpickr/dist/plugins/confirmDate/confirmDate.css' ;

Thanks @ankurk91
@bedakb please reopen if you still experience any issues

Please add

You need to import them too.

import confirmDatePlugin from 'flatpickr/dist/plugins/confirmDate/confirmDate' ;

import 'flatpickr/dist/plugins/confirmDate/confirmDate.css' ;

I'm confused... So, the script files are needed for plugins, but the core of flatpickr should be downloaded from NPM?

Please add this to the documentation! I'm sure this may be obvious to many, but I have been really struggling to track down exactly how to use the recommended NPM download and the plugins. I have been using script files for over a year and will just go back to that for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

titiyoyo picture titiyoyo  路  3Comments

mgohin picture mgohin  路  4Comments

rafaelrenanpacheco picture rafaelrenanpacheco  路  4Comments

mponton picture mponton  路  3Comments

Spoki4 picture Spoki4  路  3Comments