diff --git a/.changeset/fix-edit-config-minimatch.md b/.changeset/fix-edit-config-minimatch.md new file mode 100644 index 0000000..e96cf75 --- /dev/null +++ b/.changeset/fix-edit-config-minimatch.md @@ -0,0 +1,6 @@ +--- +'@powersync/cli-plugin-config-edit': patch +'powersync': patch +--- + +fix `powersync edit config` crashing with `Cannot find module 'minimatch'` by keeping `@oclif/core` external in the editor server build diff --git a/packages/editor/vite.config.ts b/packages/editor/vite.config.ts index 1ffb001..0a542f7 100644 --- a/packages/editor/vite.config.ts +++ b/packages/editor/vite.config.ts @@ -11,13 +11,21 @@ const config = defineConfig({ }, plugins: [ devtools(), - nitro({ rollupConfig: { external: [/^@sentry\//], treeshake: true } }), + nitro({ rollupConfig: { external: [/^@sentry\//, /^@oclif\/core(\/|$)/], treeshake: true } }), tailwindcss(), tanstackStart({}), viteReact() ], resolve: { tsconfigPaths: true + }, + // `@oclif/core` is CommonJS and lazily `require()`s its own dependencies (for example + // `minimatch` from its plugin loader). Inlining it into the server bundle moves those + // `require()` calls out of its own `node_modules` context, so at runtime they resolve + // relative to `editor-dist/` and fail under strict (non-hoisted) installs. + // Keep it external so it is loaded from the published plugin's own `node_modules`. + ssr: { + external: ['@oclif/core'] } });