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
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.
The text was updated successfully, but these errors were encountered:
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:
<script type=module src="x">
is encountered, rewrite "x" to "../path/to/x.js?__module=true"<script type=module>
andimport * as x from 'x';
encountered, rewrite "x" to "../path/to/x.js?__module=true"__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.
The text was updated successfully, but these errors were encountered: