Skip to content

v4.0.0-0

Pre-release
Pre-release

Choose a tag to compare

@hmsk hmsk released this 09 Nov 19:49
· 48 commits to main since this release
v4.0.0-0
e2bdfbf

The first prerelease of v4, for Vite 6, 7 and 8. Install it with npm i -D vite-plugin-elm@next elm.

Breaking changes

  • Supports Vite 6, 7 and 8, and Node.js ^20.19.0 || >=22.12.0. Stay on v3 for Vite 5.
  • The plugin runs elm make by itself instead of through node-elm-compiler (#873). Install elm in your project, or have it in PATH.
  • nodeElmCompilerOptions is removed. Use the new pathToElm option instead of nodeElmCompilerOptions.pathToElm.
  • Compile errors are reported in the format of the Elm CLI. They keep colors in the terminal and point at the file and line on Vite's overlay.
  • If you use elm-optimize-level-2 through compiler, move to postprocess to keep static assets and ?with= working.

See Migrating from v3.

New

  • pathToElm, and a lookup for elm from the closest node_modules/.bin, then PATH (#2)
  • postprocess to transform the compiled code, e.g. with elm-optimize-level-2's transform (#646, #878)
  • /* @__PURE__ */ annotations, which make the example's bundles about 40% smaller (#837, #875)
  • Tested with Elm 0.19.1, 0.19.2 and 0.19.3 (#877)

Fixes

  • HMR works when the Vite root isn't the cwd. This was a hard error on Vite 8 (#806, #872).
  • No deprecation warnings from Vite's Environment API, and moduleType: 'js' for Rolldown (#872)
  • Passing something other than a string literal to VitePluginHelper.asset shows an error on the overlay instead of crashing the dev server (#455, #874).
  • Asset tags are found in any quotes, and right after another tag (#878).
  • The dev server compiles only the files that server.fs.allow permits (#879).
  • Imports in Elm block comments are no longer taken as dependencies (#873).
  • find-up is replaced with a small elm.json lookup (#871).

Internal

  • CI covers Node 20, 22, 24 and 26 on Linux, plus Windows and macOS.
  • oxlint and oxfmt replace ESLint and Prettier (#876).