mirror of
https://github.com/epistemic-technology/co-intelligence.git
synced 2026-07-22 06:45:17 +00:00
Externalize @codemirror/state and @codemirror/view from the bundle
Obsidian ships CodeMirror in its runtime; bundling our own copy is both wasteful (~200 kB) and risky (two CM6 instances in the host). The bundling-by-default also broke pnpm installs because pnpm doesn't hoist devDependencies the way npm does, so Rollup couldn't resolve the import paths. Externalising drops the plugin back to ~620 kB and matches the recommended pattern for Obsidian plugins that use CM6. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
1cc9edf63c
commit
dbf4f2e96f
1 changed files with 8 additions and 1 deletions
|
|
@ -34,7 +34,14 @@ export default defineConfig({
|
|||
fileName: () => "main.js",
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ["obsidian", "electron"], // don't bundle the host libs
|
||||
// Obsidian's runtime already loads CodeMirror; importing it as a peer
|
||||
// keeps our bundle small and avoids two CM6 instances in the host.
|
||||
external: [
|
||||
"obsidian",
|
||||
"electron",
|
||||
"@codemirror/state",
|
||||
"@codemirror/view",
|
||||
],
|
||||
output: {
|
||||
exports: "named",
|
||||
assetFileNames: () => "styles.css", // Always output CSS as styles.css
|
||||
|
|
|
|||
Loading…
Reference in a new issue