From db18a36e656f726412e6f7f44bca7dbb83c4b9ee Mon Sep 17 00:00:00 2001 From: lishid Date: Mon, 1 Nov 2021 15:17:03 -0400 Subject: [PATCH] Update build script to include external node packages. --- esbuild.config.mjs | 31 ++++++++++++++++--------------- main.ts | 2 ++ package.json | 11 ++++++----- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/esbuild.config.mjs b/esbuild.config.mjs index d1c1ba2..5d87383 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,27 +1,28 @@ import esbuild from "esbuild"; import process from "process"; +import builtins from 'builtin-modules' -const banner = +const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD -if you want to view the source visit the plugins github repository +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: ['main.ts'], - bundle: true, - external: ['obsidian'], - format: 'cjs', - watch: !prod, - target: 'es2016', - logLevel: "info", - sourcemap: prod ? false : 'inline', - treeShaking: true, - outfile: 'main.js', + banner: { + js: banner, + }, + entryPoints: ['main.ts'], + bundle: true, + external: ['obsidian', 'electron', ...builtins], + format: 'cjs', + watch: !prod, + target: 'es2016', + logLevel: "info", + sourcemap: prod ? false : 'inline', + treeShaking: true, + outfile: 'main.js', }).catch(() => process.exit(1)); diff --git a/main.ts b/main.ts index b942689..9b24b2f 100644 --- a/main.ts +++ b/main.ts @@ -1,5 +1,7 @@ import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian'; +// Remember to rename these classes and interfaces! + interface MyPluginSettings { mySetting: string; } diff --git a/package.json b/package.json index 12f049d..11071f9 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,13 @@ "author": "", "license": "MIT", "devDependencies": { - "@types/node": "^16.11.1", - "esbuild": "0.13.11", + "@types/node": "^16.11.6", + "@typescript-eslint/eslint-plugin": "^5.2.0", + "@typescript-eslint/parser": "^5.2.0", + "builtin-modules": "^3.2.0", + "esbuild": "0.13.12", "obsidian": "^0.12.17", "tslib": "2.3.1", - "typescript": "4.4.4", - "@typescript-eslint/eslint-plugin": "^5.2.0", - "@typescript-eslint/parser": "^5.2.0" + "typescript": "4.4.4" } }