Automattic / Automattic/jetpack

Jetpack::maybe_min_asset should check the SCRIPT_DEBUG value

Open
#17,503 1 comment 0 reactions 1 assignee Claimed by @kbrown9 View on GitHub
[Package] Assets [Pri] Low Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

The `SCRIPT_DEBUG` constant allows developers to [work with non-minified versions](https://github.com/Automattic/jetpack/blob/eaa39d4967b26e6098c7df03799bda4da06be93d/docs/development-environment.md#script_debug) of .js files. However, `JETPACK::maybe_min_asset` doesn't check the value of that constant before using a minified asset.

#### Steps to Reproduce
1. Install, activate, and connect Jetpack.
2. Enable lazy image loading.
3. Create a post.
4. Visit the post, open the browser inspector, and check the version of the `lazy-images.js` file. You should see the `lazy-images.min.js` file is used.
5. Set the `SCRIPT_DEBUG` constant to true.
6. Visit the post from step 3 again and check the browser inspector. The minified version is still used.

(I added the Bug label to this because the behavior was unexpected, but this issue only affects developers. Users are not affected.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.