Skip to content

Conversation

@rhcarvalho
Copy link
Contributor

Related to phoenixframework/phoenix_live_view#4062 (comment).

Update the mix phx.new installer to configure esbuild to output ESM modules by default in new Phoenix projects.

ESM modules enable tree shaking, code splitting, and enforce JavaScript strict mode, which can be beneficial for reducing bundle sizes, and catching common coding errors earlier.

In the JavaScript ecosystem, modern bundlers like Vite output ESM modules by default.

If a developer discovers later that they strictly need to support a non-module environment (like a third-party embed), it is trivial to go back to an IIFE output target.

Update the `mix phx.new` installer to configure `esbuild` to output ESM
modules by default in new Phoenix projects.

ESM modules enable tree shaking, code splitting, and enforce JavaScript
strict mode, which can be beneficial for reducing bundle sizes, and
catching common coding errors earlier.

In the JavaScript ecosystem, modern bundlers like Vite output ESM
modules by default.

If a developer discovers later that they strictly need to support a
non-module environment (like a third-party embed), it is trivial to go
back to an IIFE output target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant