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

Created on 22 October 2023, about 1 year ago
Updated 23 October 2023, about 1 year ago

Hello,

In D10, there have been changes in the core libraries.

I have this error in my browser console in my fresh D10.

Problem/Motivation

drupal.js?v=10.1.5:64 Uncaught TypeError: $(...).once is not a function
at Object.attach (social_simple.js?s2xx4s:10:45)
at drupal.js?v=10.1.5:166:24
at Array.forEach ()
at Drupal.attachBehaviors (drupal.js?v=10.1.5:162:34)
at drupal.init.js?v=10.1.5:32:12
at HTMLDocument.listener (drupal.init.js?v=10.1.5:20:7)
attach @ social_simple.js?s2xx4s:10
(anonymous) @ drupal.js?v=10.1.5:166
Drupal.attachBehaviors @ drupal.js?v=10.1.5:162
(anonymous) @ drupal.init.js?v=10.1.5:32
listener @ drupal.init.js?v=10.1.5:20

Here is a part mon my subtheme.librairies.yml:

global-styling:
  version: VERSION
  js:
    js/global.js: {}
    js/HideMenuOnScroll.js: {}
  css:
    component:
      css/style.css: { weight: 10 }
      css/all.min.css: {}
  dependencies:
    - core/jquery
    - core/jquery.once
    - core/drupal

I have try - core/once instead jquery.once

Perhaps a solution here : https://kinsta.com/knowledgebase/uncaught-typeerror-is-not-a-function/#1... for a new release?

Thanks.

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇫🇷France floown

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

Comments & Activities

Production build 0.71.5 2024