From 92ca78709227c6117797c52eada7d471bb4ba96a Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Wed, 05 Jul 2023 01:26:11 +0000
Subject: [PATCH] fix default callout state

---
 quartz/bootstrap-cli.mjs |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index e9cda4e..3f71b17 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -64,19 +64,25 @@
       packages: "external",
       plugins: [
         sassPlugin({
-          type: 'css-text'
+          type: 'css-text',
         }),
         {
           name: 'inline-script-loader',
           setup(build) {
             build.onLoad({ filter: /\.inline\.(ts|js)$/ }, async (args) => {
               let text = await promises.readFile(args.path, 'utf8')
+              // remove default exports that we manually inserted
+              text = text.replace('export default', '')
+              text = text.replace('export', '')
+
+              const sourcefile = path.relative(path.resolve('.'), args.path)
+              const resolveDir = path.dirname(sourcefile)
               const transpiled = await esbuild.build({
                 stdin: {
                   contents: text,
                   loader: 'ts',
-                  resolveDir: '.',
-                  sourcefile: path.relative(path.resolve('.'), args.path),
+                  resolveDir,
+                  sourcefile,
                 },
                 write: false,
                 bundle: true,

--
Gitblit v1.10.0