diff --git a/.changeset/chilly-pugs-pay.md b/.changeset/chilly-pugs-pay.md new file mode 100644 index 0000000000..4688a2126a --- /dev/null +++ b/.changeset/chilly-pugs-pay.md @@ -0,0 +1,5 @@ +--- +'@directus/extensions-sdk': patch +--- + +Silenced prefer builtins and circular dependency warnings when building extensions diff --git a/packages/extensions-sdk/src/cli/commands/build.ts b/packages/extensions-sdk/src/cli/commands/build.ts index 54457327d6..aec8bbbd81 100644 --- a/packages/extensions-sdk/src/cli/commands/build.ts +++ b/packages/extensions-sdk/src/cli/commands/build.ts @@ -591,7 +591,7 @@ function getRollupOptions({ languages.includes('typescript') ? esbuild({ include: /\.tsx?$/, sourceMap: sourcemap }) : null, mode === 'browser' ? styles() : null, ...plugins, - nodeResolve({ browser: mode === 'browser' }), + nodeResolve({ browser: mode === 'browser', preferBuiltins: mode === 'node' }), commonjs({ esmExternals: mode === 'browser', sourceMap: sourcemap }), json(), replace({ @@ -602,6 +602,11 @@ function getRollupOptions({ }), minify ? terser() : null, ], + onwarn(warning, warn) { + if (warning.code === 'CIRCULAR_DEPENDENCY' && warning.ids?.every((id) => /\bnode_modules\b/.test(id))) return; + + warn(warning); + }, }; }