Skip to content

Commit

Permalink
chore: minify bundle, don't ship sourcemaps
Browse files Browse the repository at this point in the history
We haven't found much use for sourcemaps in production, and we should probably minify the bundle anyway. This will also remove an dev only warnings react used to log.
  • Loading branch information
threepointone committed May 5, 2022
1 parent 62680f6 commit ecde3b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/cold-pianos-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

chore: minify bundle, don't ship sourcemaps

we haven't found much use for sourcemaps in production, and we should probably minify the bundle anyway. This will also remove an dev only warnings react used to log.
2 changes: 1 addition & 1 deletion packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"bundle": "node -r esbuild-register scripts/bundle.ts",
"build": "npm run clean && npm run bundle",
"prepublishOnly": "npm run build",
"start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
"start": "SOURCEMAPS=true npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
"test": "jest --silent=false --verbose=true",
"test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/scripts/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function run() {
outdir: "./wrangler-dist",
platform: "node",
format: "cjs",
// minify: true, // TODO: enable this again
minify: true,
external: [
"fsevents",
"esbuild",
Expand All @@ -23,7 +23,7 @@ async function run() {
"@esbuild-plugins/node-globals-polyfill",
"@esbuild-plugins/node-modules-polyfill",
],
sourcemap: true,
sourcemap: process.env.SOURCEMAPS === "true",
inject: [path.join(__dirname, "../import_meta_url.js")],
define: {
"import.meta.url": "import_meta_url",
Expand All @@ -39,7 +39,7 @@ async function run() {
format: "esm",
minify: true,
external: ["miniflare", "@miniflare/core"],
sourcemap: true,
sourcemap: process.env.SOURCEMAPS === "true",
});
}

Expand Down

0 comments on commit ecde3b3

Please sign in to comment.