Opened 2 years ago

Closed 2 years ago

Last modified 23 months ago

#34100 closed New feature (duplicate)

Support js import statement with ManifestStaticFilesStorage

Reported by: blighj Owned by: nobody
Component: contrib.staticfiles Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Browsers now have good support for the import statement of javascript
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#syntax
Which is in the form

import defaultExport from "module-name.js";
import "../module-name2.js";

Something like the below added to the js patterns of HashedFilesMixin should cover both use cases

                (
                    r"""(?P<matched>import(?P<from>[\s\{].*?from)\s*?['"](?P<url>[\w\.\/-]*?)["']\s*?;)""",
                    """import%(from)s"%(url)s";""",
                ),
                (
                    r"""(?P<matched>import\s*?['"](?P<url>[\w\.\/-]*?)["']\s*?;)""",
                    """import"%(url)s";""",
                ),

Change History (4)

comment:1 by blighj, 2 years ago

Version: 4.1dev

comment:2 by Keryn Knight, 2 years ago

Possibly this is a duplicate of #32319, which had an implementation, but had to be reverted due to #33253.

comment:3 by blighj, 2 years ago

Resolution: duplicate
Status: newclosed

Yes it's a duplicate, closing this ticket.

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 23 months ago

In c179ad9f:

Refs #34100 -- Made file upload tests use Storage.exists() where appropriate.

Note: See TracTickets for help on using tickets.
Back to Top