strict js and preprocessing

Created on 21 April 2023, about 1 year ago

Problem/Motivation

Since Drupal 9.5.1, some "use strict;" lines of code can be found in the js global scope after preprocessing.
Quite a few modules are experimenting issues (including core ones).

For the record, for fancybox_ui, the console error is :
Uncaught TypeError: setting getter-only property "window"

Steps to reproduce

Use a fancybox on a ^9.5.1 install with preprocessed js.

Proposed resolution

There are 3 solutions to this.
(quick fix) : forbidding preprocessing (below patch solution).
(quick fix) : changing lib weight so the library javascript code is preprend rather then append to the minified file.
(proper one in my opinion) : refactor js code to strict mode.

πŸ› Bug report
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡«πŸ‡·France MBidinger

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

Comments & Activities

Production build 0.69.0 2024