Skip to content

Commit

Permalink
Silence prefer builtins and circular dependency warnings when buildin…
Browse files Browse the repository at this point in the history
…g extensions (#18366)

* Silence prefer builtins warning

* Silence circular dependency warning if only external files are involved

* Add changeset
  • Loading branch information
nickrum committed Apr 28, 2023
1 parent 76ae228 commit 3ff71cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-pugs-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@directus/extensions-sdk': patch
---

Silenced prefer builtins and circular dependency warnings when building extensions
7 changes: 6 additions & 1 deletion packages/extensions-sdk/src/cli/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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);
},
};
}

Expand Down

0 comments on commit 3ff71cc

Please sign in to comment.