flatpickr plugin not working

Created on 26 October 2025, 6 days ago

Problem/Motivation

I'm getting these errors when using the flatpickrJs plugin:


article:1 Refused to apply style from 'https://drupal.11.2.2.ddev.site/libraries/flatpickr/dist/flatpickr.css?t4r4f8' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
article:2497 
 GET https://drupal.11.2.2.ddev.site/libraries/flatpickr/dist/flatpickr.js?v=11.2.2 net::ERR_ABORTED 404 (Not Found)
[Violation] Forced reflow while executing JavaScript took 38ms
article:1 Refused to execute script from 'https://drupal.11.2.2.ddev.site/libraries/flatpickr/dist/flatpickr.js?v=11.2.2' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

drupal.js?v=11.2.2:64 Uncaught TypeError: $(...).flatpickr is not a function
    at Object.attach (flatpickr.js?v=11.2.2:26:72)
    at drupal.js?v=11.2.2:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=11.2.2:162:34)
    at HTMLUListElement.<anonymous> (ajax.js?v=11.2.2:1404:18)
    at T.each (jquery.min.js?v=4.0.0-beta.2:2:2876)
    at T.fn.init.each (jquery.min.js?v=4.0.0-beta.2:2:1386)
    at Drupal.AjaxCommands.insert (ajax.js?v=11.2.2:1396:19)
    at ajax.js?v=11.2.2:1048:41
drupal.js?v=11.2.2:64 Uncaught TypeError: $(...).flatpickr is not a function
    at Object.attach (flatpickr.js?v=11.2.2:26:72)
    at drupal.js?v=11.2.2:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=11.2.2:162:34)
    at HTMLAnchorElement.<anonymous> (ajax.js?v=11.2.2:1404:18)
    at T.each (jquery.min.js?v=4.0.0-beta.2:2:2876)
    at T.fn.init.each (jquery.min.js?v=4.0.0-beta.2:2:1386)
    at Drupal.AjaxCommands.insert (ajax.js?v=11.2.2:1396:19)
    at ajax.js?v=11.2.2:1048:41
drupal.js?v=11.2.2:64 Uncaught TypeError: $(...).flatpickr is not a function
    at Object.attach (flatpickr.js?v=11.2.2:26:72)
    at drupal.js?v=11.2.2:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=11.2.2:162:34)
    at drupal.init.js?v=11.2.2:32:12
    at HTMLDocument.listener (drupal.init.js?v=11.2.2:20:7)
drupal.js?v=11.2.2:64 Uncaught TypeError: $(...).flatpickr is not a function
    at Object.attach (flatpickr.js?v=11.2.2:26:72)
    at drupal.js?v=11.2.2:166:24
    at Array.forEach (<anonymous>)
    at Drupal.attachBehaviors (drupal.js?v=11.2.2:162:34)
    at HTMLAnchorElement.<anonymous> (ajax.js?v=11.2.2:1404:18)
    at T.each (jquery.min.js?v=4.0.0-beta.2:2:2876)
    at T.fn.init.each (jquery.min.js?v=4.0.0-beta.2:2:1386)
    at Drupal.AjaxCommands.insert (ajax.js?v=11.2.2:1396:19)
    at ajax.js?v=11.2.2:1048:41
attach	@	flatpickr.js?v=11.2.2:26
(anonymous)	@	drupal.js?v=11.2.2:166
Drupal.attachBehaviors	@	drupal.js?v=11.2.2:162
(anonymous)	@	ajax.js?v=11.2.2:1404
each	@	jquery.min.js?v=4.0.0-beta.2:2
each	@	jquery.min.js?v=4.0.0-beta.2:2
insert	@	ajax.js?v=11.2.2:1396
(anonymous)	@	ajax.js?v=11.2.2:1048
Promise.then		
(anonymous)	@	ajax.js?v=11.2.2:1041
Drupal.Ajax.commandExecutionQueue	@	ajax.js?v=11.2.2:1038
Drupal.Ajax.success	@	ajax.js?v=11.2.2:1097
processReplacement	@	big_pipe.js?v=11.2.2:84
checkMutationAndProcess	@	big_pipe.js?v=11.2.2:109
(anonymous)	@	big_pipe.js?v=11.2.2:133
processMutations	@	big_pipe.js?v=11.2.2:132


Steps to reproduce

Enable the module and use the flatpickrJS

Proposed resolution

It seems like there is an issue with the library definition:

        "flatpickr-library": {
          "type": "package",
          "package": {
            "name": "flatpickr/flatpickr",
            "version": "4.6.13",
            "type": "drupal-library",
            "extra": {
              "installer-name": "flatpickr"
            },
            "dist": {
              "url": "https://github.com/flatpickr/flatpickr/archive/refs/tags/v4.6.13.zip",
              "type": "zip"
            }
          }
        }

The release https://github.com/flatpickr/flatpickr/archive/refs/tags/v4.6.13.zip used to have the dist directory, which has all the javascript and css files in order for the library to work, it doesn't seem the case anymore, and we might fork the project to include the missing dist library.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇦Canada danrod Ottawa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024