v133
In v133, we introduced the ?raw
mode that returns the raw JS files and fixed a bunch of bugs.
Escape Hatch: Raw Source Files
In rare cases, you may want to request JS source files from packages, as-is, without transformation into ES modules. To do so, you need to add a ?raw
query to the request URL.
For example, you might need to register a package's source script as a service worker in a browser that does not yet support the type: "module"
option:
await navigator.serviceWorker.register(
new URL(
"https://esm.sh/[email protected]/playground-service-worker.js?raw",
import.meta.url.href
),
{ scope: '/' }
);
You may alternatively specify an &raw
extra query after the package version:
<playground-project sandbox-base-url="https://esm.sh/[email protected]&raw/"
></playground-project>
so that transitive references in the raw assets will also be raw requests.
Thanks @johnyanarella for contributing to this.
Changlog:
- Add
?raw
to support requests for raw package source files (#731 by @johnyanarella) - Add global
setMaxListeners
tonode:events
polyfill (#719) - cjs-lexer: resolving error now doesn't break build (close #738)
- Fix
cwd
method ofnode:process
polyfill (close #718) - Fix
applyConditions
function usenode
condition for browser (close #732) - Fix
*.css.js
path (close #728) - Fix some invalid require imports (close #724)
- Fix relative path resolving of
browser
in package.json - Upgrade esbuild to 0.19.4