diff esbuild.config.mjs @ 0:7975d7c73f8a 1.0.0

Initial commit
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 08 Feb 2022 21:40:33 -0800
parents
children 2a9e941c96ee
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/esbuild.config.mjs	Tue Feb 08 21:40:33 2022 -0800
@@ -0,0 +1,35 @@
+import esbuild from "esbuild";
+import process from "process";
+import builtins from 'builtin-modules'
+
+const banner =
+`/*
+THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
+if you want to view the source, please visit the github repository of this plugin
+*/
+`;
+
+const prod = (process.argv[2] === 'production');
+
+esbuild.build({
+	banner: {
+		js: banner,
+	},
+	entryPoints: ['src/main.ts'],
+	bundle: true,
+	external: [
+		'obsidian', 
+		'electron', 
+		'@codemirror', 
+		'@codemirror/state', 
+		'@codemirror/view', 
+		...builtins
+	],
+	format: 'cjs',
+	watch: !prod,
+	target: 'es2016',
+	logLevel: "info",
+	sourcemap: prod ? false : 'inline',
+	treeShaking: true,
+	outfile: 'main.js',
+}).catch(() => process.exit(1));