Jacky Zhao
2023-06-20 fd5c8d17d3b3cd0a13b0a21a2b78d85010e02e12
quartz/bootstrap-cli.mjs
@@ -71,11 +71,18 @@
          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',
                  sourcefile: path.relative(path.resolve('.'), args.path),
                  resolveDir,
                  sourcefile,
                },
                write: false,
                bundle: true,