Add minified ESM build output for each package#4820
Merged
calebporzio merged 1 commit intomainfrom Apr 30, 2026
Merged
Conversation
Emit `module.esm.min.js` alongside the existing `module.esm.js` and `module.cjs.js` so browsers loading modules directly from `node_modules` (via `<script type="module">`) have a minified option without needing a bundler. This restores a path that users had been importing from in previous releases. The file was present in earlier tarballs only as a stale artifact from a maintainer's local `dist/` folder, and disappeared in 3.15.11 when the release workflow moved to a clean checkout. Fixes #4818
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Scenario
Users loading Alpine directly in the browser via
<script type="module">(no bundler) have been importing Alpine from a minified ESM file that was present in every npm tarball up to 3.15.10:From 3.15.11 onwards that file is gone, so the import fails and the page breaks.
The Problem
dist/module.esm.min.jshas never actually been produced byscripts/build.js. Themodule.jsbranch ofbundleFile()only emitsmodule.esm.jsandmodule.cjs.js; only thecdn.jsbranch produces a.min.jsvariant:The file that shipped in previous releases was a stale artifact from a maintainer's local
dist/folder, generated by an older build and swept into eachnpm publishbecausedist/is not cleaned before builds. The 3.14.9 and 3.15.10 tarballs on npm both contain byte-for-byte identicalmodule.esm.min.jsfiles withversion:"3.13.10"baked in, meaning anyone importing that path for the last several releases has been running 3.13.10 code regardless of the installed version.3.15.11 was the first release cut by the new GitHub Actions workflow, which runs from a clean checkout, so the stale file no longer rides along.
The Solution
Add a legitimate minified ESM output to the
module.jsbranch inscripts/build.js, mirroring the pattern already used bycdn.js/cdn.min.js:This restores the file path users were already relying on and makes the no-bundler ESM use case a first-class build target. Because the file is now generated from the current source on every release, it will contain the correct
ALPINE_VERSIONrather than being frozen at 3.13.10.The change applies uniformly to every module-emitting package (
alpinejsplus the plugins), keeping the three module outputs consistent:module.esm.js,module.esm.min.js,module.cjs.js.Fixes #4818