You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Right now the middleware, upon encountering .js content, attempts to parse and convert all import specifiers. Apart from being expensive, this is totally unnecessary in cases where delivered .js is not a module (i.e. for regular script tags etc.)
What about this:
When processing HTML content and a <script type=module src="x"> is encountered, rewrite "x" to "../path/to/x.js?__module=true"
When processing HTML content with inline module <script type=module> and import * as x from 'x'; encountered, rewrite "x" to "../path/to/x.js?__module=true"
When process JS content, watch for __module=true query param. If present, remove the query param and forward to proxy, process the returned content and then rewrite specifiers to also include the __module=true query param. (The removal of __module=true query param makes the __module=true bit invisible to the next middleware/proxy in the chain.) Otherwise, do nothing.
This will enable much more performant serving of files which contain a mix of JS types.