Skip to content

Commit e74f5dd

Browse files
authored
build: externalize deps from server-util #1966 (#1967)
1 parent 142f55f commit e74f5dd

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

packages/server-util/vite.config.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,22 @@ export default defineConfig((conf) => ({
4141
rollupOptions: {
4242
// make sure to externalize deps that shouldn't be bundled
4343
// into your library
44-
external: (source: string) => {
45-
if (deps.includes(source)) {
46-
return true;
47-
}
48-
49-
if (source === "react/jsx-runtime") {
50-
return true;
51-
}
52-
53-
if (source.startsWith("prosemirror-")) {
54-
return true;
55-
}
56-
57-
return false;
58-
},
44+
external: [
45+
...Object.keys({
46+
...pkg.dependencies,
47+
...pkg.peerDependencies,
48+
...pkg.devDependencies,
49+
}),
50+
"react-dom/client",
51+
"react/jsx-runtime",
52+
],
5953
output: {
6054
// Provide global variables to use in the UMD build
6155
// for externalized deps
62-
globals: {},
56+
globals: {
57+
react: "React",
58+
"react-dom": "ReactDOM",
59+
},
6360
interop: "compat", // https://rollupjs.org/migration/#changed-defaults
6461
},
6562
},

0 commit comments

Comments
 (0)