#36969: collectstatic post-processing with support_js_module_import_aggregation
breaks on certain javascript files
-------------------------------------+------------------------------------
Reporter: blighj | Owner: blighj
Type: Bug | Status: assigned
Component: contrib.staticfiles | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+------------------------------------
Changes (by blighj):
* component: Documentation => contrib.staticfiles
* owner: (none) => blighj
* status: new => assigned
* type: Cleanup/optimization => Bug
Comment:
I've done some futher exploring, and two of the three cases, (and a lot of
the issues I've come across in my own experience), are covered by the
import in quotes problems. The following regex would fix that, so
potentially we could use that and not have to update the docs at all. What
do you thing Jacob?
I've tested the regex's against the benchmark projects I use and it is
doing the job. During that testing I did find an issue on the xstate js
lib, which wasn't directly caused by the change, but in discoverying a fix
for it you get a fix for 35371 too. So we can move this pretty far along
with just regexs, way further than I first suspected.
I've moved the ticket back to bug and assigned myself the owner for now.
But I'll hold off on a PR until I get your input.
{{{
_css_ignored_re = _lazy_re_compile(
r"/\*.*?\*/" # block comment
r"|'(?:[^'\\]|\\.)*'" # single-quoted string
r'|"(?:[^"\\]|\\.)*"', # double-quoted string
re.DOTALL,
)
_js_ignored_re = _lazy_re_compile(
r"/\*.*?\*/" # block comment
r"|//[^\n]*" # line comment
r"|'(?:[^'\\]|\\.)*'" # single-quoted string
r'|"(?:[^"\\]|\\.)*"' # double-quoted string
r"|`(?:[^`\\]|\\.)*`", # template literal
re.DOTALL,
)
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/36969#comment:13>