gapmiss_blur/esbuild.config.mjs
@gapmiss 6850afbefd Fix Obsidian community scorecard warnings
- Add eslint-plugin-obsidianmd with typescript-eslint type-checked rules
- Remove console.log from onload/onunload
- Fix type safety: proper types, unused params prefixed with _
- Use createDiv() instead of createEl("div")
- Remove !important from CSS via increased selector specificity
- Replace deprecated builtin-modules with native builtinModules
- Update esbuild config for v0.24 watch API
- Add pnpm-lock.yaml for reproducible builds
- Add GitHub release workflow with artifact attestation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-22 22:39:20 -05:00

50 lines
1 KiB
JavaScript

import esbuild from "esbuild";
import process from "process";
import { builtinModules } from "module";
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');
const buildOptions = {
banner: {
js: banner,
},
entryPoints: ['main.ts'],
bundle: true,
external: [
'obsidian',
'electron',
'@codemirror/autocomplete',
'@codemirror/collab',
'@codemirror/commands',
'@codemirror/language',
'@codemirror/lint',
'@codemirror/search',
'@codemirror/state',
'@codemirror/view',
'@lezer/common',
'@lezer/highlight',
'@lezer/lr',
...builtinModules.map(m => m),
...builtinModules.map(m => `node:${m}`),
],
format: 'cjs',
target: 'es2018',
logLevel: "info",
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
};
if (prod) {
await esbuild.build(buildOptions);
} else {
const ctx = await esbuild.context(buildOptions);
await ctx.watch();
}