From d028c6854ae3b9bc580c0e3ba4548ecf75d80642 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 22 Aug 2023 15:06:15 -0700 Subject: [PATCH] Minify JS built for production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This feels a bit weird on the idioms but ehh I think it's fineā€¦ mostly just, the `assets:precompile` task is gonna call `yarn build` here, so `yarn build` needs to be production settings; but also we want not quite all those settings on in development, so there's a base task that both the prod `build` and `dev` call. --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 73286ae2..abe5d793 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "tweenjs": "^1.0.2" }, "scripts": { - "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --loader:.js=jsx --loader:.png=file --loader:.svg=file --loader:.min.js=text", - "build:production": "yarn build --minify" + "build": "yarn build:base --minify", + "build:base": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets --loader:.js=jsx --loader:.png=file --loader:.svg=file --loader:.min.js=text", + "dev": "yarn build:base --watch" } }