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