#33336: Widget.Media.JS ESM support
-----------------------------+--------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: 3.2
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:2 James Pic]:
> And that's how the decision has been made to not support ESM in Django.
There goes a very convenient feature for modern web development!
I wouldn't say that. There are other media types that we could support
but the first step to opening this door is to handle `Media` subclasses in
Django. It would be straightforward to support JavaScript modules (or
others) with #9357, e.g.:
{{{
class MyMedia(Media):
def __init__(self, media=None, css=None, js=None, js_modules=None):
self.js_modules = js_modules
super().__init__(media, css, js)
def render_js_modules(self):
return format_html(...)
}}}
You can start a discussion on the DevelopersMailingList, where you'll
reach a wider audience and see what other think. We can always reopen this
ticket after reaching a consensus that JavaScript modules should be
treated and handled separately.
--
Ticket URL: <https://code.djangoproject.com/ticket/33336#comment:3>
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/062.4b8a9e16118fa52d377abeb2df16fd15%40djangoproject.com.