Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build CommonJS module along with ESM and IIFE #4512

Merged
merged 1 commit into from Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.exs
Expand Up @@ -20,6 +20,7 @@ if Mix.env() == :dev do
config :esbuild,
version: "0.12.18",
module: esbuild.(~w(--format=esm --sourcemap --outfile=../priv/static/phoenix.esm.js)),
main: esbuild.(~w(--format=cjs --sourcemap --outfile=../priv/static/phoenix.cjs.js)),
cdn:
esbuild.(
~w(--target=es2016 --format=iife --global-name=Phoenix --outfile=../priv/static/phoenix.js)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Expand Up @@ -198,7 +198,7 @@ defmodule Phoenix.MixProject do
defp aliases do
[
docs: ["docs", &generate_js_docs/1],
"assets.build": ["esbuild module", "esbuild cdn", "esbuild cdn_min"],
"assets.build": ["esbuild module", "esbuild cdn", "esbuild cdn_min", "esbuild main"],
"assets.watch": "esbuild module --watch"
]
end
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"description": "The official JavaScript client for the Phoenix web framework.",
"license": "MIT",
"module": "./priv/static/phoenix.esm.js",
"main": "./priv/static/phoenix.cjs.js",
"unpkg": "./priv/static/phoenix.min.js",
"jsdelivr": "./priv/static/phoenix.min.js",
"exports": {
Expand Down