Opened 4 years ago
Last modified 3 years ago
#52879 new defect (bug)
The SCRIPT_DEBUG constant is ignored when concatenating scripts
Reported by: | azaozz | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | minor | Version: | 2.8 |
Component: | Script Loader | Keywords: | needs-patch needs-testing needs-refresh |
Focuses: | javascript | Cc: |
Description
Happens because SCRIPT_DEBUG
is usually defined in wp-config.php
however that file is not used in load-scripts.php
and load-styles.php
. This results in non-minified files being concatenated and outputted when SCRIPT_DEBUG is false and WP runs from /src.
Attachments (1)
Change History (12)
#2
@
4 years ago
In 52879.patch: The long way of doing this. Pass SCRIPT_DEBUG to load-scripts.php and load-styles.php so script loader would properly choose the minified files. A shorter way may be to just assume SCRIPT_DEBUG is set to false when running from /src and concatenation (load-scripts.php or load-styles.php) is used.
#4
@
4 years ago
No guarantee. Up-to-date js and minified files (and some php files) would exist in /src only after npm run dev
(to "watch") or npm run build:dev
has been run. This is a problem and there are few tickets about it. But thinking being able to run from /src with SCRIPT_DEBUG = false should work properly in any case.
#5
@
4 years ago
Tested the patch and minified scripts are now being loaded correctly when SCRIPT_DEBUG is false.
Up-to-date js and minified files (and some php files) would exist in /src only after npm run dev (to "watch") or npm run build:dev has been run.
Is it a problem though? The default local environment setup requires npm run build:dev
to be run anyway.
#6
@
4 years ago
- Milestone changed from 5.8 to 5.9
Today is a freeze for 5.8 as it's Beta 1 day. As discussion is ongoing, punting to 5.9.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#8
@
3 years ago
- Milestone changed from 5.9 to 6.0
As per today's bug scrub, let's move this ticket to the next milestone for proper review/refresh.
This ticket was mentioned in Slack in #core by mike. View the logs.
3 years ago
#10
@
3 years ago
- Focuses javascript added
- Keywords needs-patch needs-testing needs-refresh added
This was discussed during a bug scrub.
Are there any related tickets/test cases that can be provided to further demonstrate when this bug is happening. Is there a general effect or is the effect only evident when testing?
The code generally looks good but in the script-loader file changes, it would be good to switch to the
/* * multi-line comments format * defined by the WP coding standards */
It seems this has been largely unnoticed as was very rare to need to load minified files when running from /src. However tests now run from /src and it seems minified files should be able to be used when testing. That can be done with SCRIPT_DEBUG = false.