#35371: False positive in JS module aggregation export regex when an export
declaration precedes an import declaration
-------------------------------------+------------------------------------
Reporter: Michael | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: dev
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 Sarah Boyce):
* stage: Unreviewed => Accepted
* summary: JS module export regex does not handle certain minified code
correctly =>
False positive in JS module aggregation export regex when an export
declaration precedes an import declaration
* type: Uncategorized => Bug
* version: 5.0 => dev
Comment:
Thank you for the report! Replicated on main.
This can occur also when the JS is not minified.
For anyone wanting to pick this up. If we make the following update:
{{{
diff --git a/tests/staticfiles_tests/project/documents/cached/module.js
b/tests/staticfiles_tests/project/documents/cached/module.js
index 7764e740d6..e9e61df56c 100644
--- a/tests/staticfiles_tests/project/documents/cached/module.js
+++ b/tests/staticfiles_tests/project/documents/cached/module.js
@@ -1,3 +1,4 @@
+export const moduleConst = "module";
// Static imports.
import rootConst from "/static/absolute_root.js";
import testConst from "./module_test.js";
}}}
then tests for
`staticfiles_tests.test_storage.TestCollectionJSModuleImportAggregationManifestStorage`
fail with the reported error.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35371#comment:3>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.