#35553: HashedFilesMixin for ES modules does not work with `import * as ...`
syntax
-------------------------------------+-------------------------------------
Reporter: Michael | Owner: nobody
Type: | Status: new
Uncategorized |
Component: | Version: 5.0
contrib.staticfiles | Keywords: Manifest Static
Severity: Normal | Files Storage, javascript module
Triage Stage: | scripts
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Django's regex does not work with the following:
{{{
import*as l from "/static/jsapp/jsapp/dtmod.min.js";import*as h from
"/static/jsapp/jsapp/nummod.min.js";import*as m from
"/static/leave/jsapp/fetcher.min.js";import {BaseComponent as g} from
"/static/wcapp/jsapp/wc-base.min.425310100bce.js";
}}}
As you can see only the 4th import was correctly altered, the first 3
werent even detected, (below is the same as above but placed the imports
on seprate lines for readability):
{{{
import*as l from "/static/jsapp/jsapp/dtmod.min.js";
import*as h from "/static/jsapp/jsapp/nummod.min.js";
import*as m from "/static/leave/jsapp/fetcher.min.js";
import {BaseComponent as g} from "/static/wcapp/jsapp/wc-
base.min.425310100bce.js";
}}}
This regex handles the missing case:
{{{
(
r"""(?P<matched>(?P<import_as>import\s*\*as\s\S+)\s+from\s*["'](?P<url>[./].*?)["']\s*;)""",
"""%(import_as)s from "%(url)s";""",
),
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35553>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701904577ca27-436b6d53-b6cc-4136-b95b-1eb689f42cf1-000000%40eu-central-1.amazonses.com.