From a0d651d64dfd766157324fd86791da2168028cf2 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sun, 06 Aug 2023 00:53:29 +0000
Subject: [PATCH] reverse query param hack to re-add sourcemap support

---
 quartz/bootstrap-cli.mjs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index 68b9f57..8b9bea9 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -16,6 +16,7 @@
 import http from "http"
 import serveHandler from "serve-handler"
 import { WebSocketServer } from "ws"
+import { randomUUID } from "crypto"
 
 const ORIGIN_NAME = "origin"
 const UPSTREAM_NAME = "upstream"
@@ -297,7 +298,8 @@
       outfile: path.join("quartz", cacheFile),
       bundle: true,
       keepNames: true,
-      minify: true,
+      minifyWhitespace: true,
+      minifySyntax: true,
       platform: "node",
       format: "esm",
       jsx: "automatic",
@@ -305,6 +307,7 @@
       packages: "external",
       metafile: true,
       sourcemap: true,
+      sourcesContent: false,
       plugins: [
         sassPlugin({
           type: "css-text",
@@ -372,7 +375,8 @@
       }
 
       // bypass module cache
-      const { default: buildQuartz } = await import(cacheFile + `?update=${new Date()}`)
+      // https://github.com/nodejs/modules/issues/307
+      const { default: buildQuartz } = await import(cacheFile + `?update=${randomUUID()}`)
       await buildQuartz(argv, clientRefresh)
       clientRefresh()
     }

--
Gitblit v1.10.0