Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit e427816

Browse files
committed
fix(nitro-node/build): electron got included as dependency
When bundling with rollup, `electron` got included as dependency due to a transitive dependency, `download@8.0.0` requires `got@^8.3.1`, which in turn requires `electron` conditionally.
1 parent 0516440 commit e427816

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

nitro-node/rollup.config.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ export default [
1313
],
1414
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
1515
external: [
16-
"electron",
17-
"node:fs",
18-
"node:child_process",
19-
"node:os",
20-
"node:path",
16+
// `download@8.0.0` requires `got@^8.3.1` which then optionally requires `electron`, result in wrong dependency
17+
// Ref: https://github.com/kubernetes-client/javascript/issues/350#issue-500860208
18+
// Ref: https://github.com/kubernetes-client/javascript/issues/350#issuecomment-553644659
19+
"got",
2120
],
2221
watch: {
2322
include: "src/**",
@@ -30,15 +29,13 @@ export default [
3029
// https://github.com/rollup/rollup-plugin-node-resolve#usage
3130
resolve({
3231
extensions: [".ts", ".js", ".json"],
33-
preferBuiltins: false,
3432
}),
3533
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
3634
// This should be after resolve() plugin
3735
commonjs(),
3836
// Compile TypeScript files
3937
typescript({
4038
useTsconfigDeclarationDir: true,
41-
tsconfig: "tsconfig.json",
4239
}),
4340

4441
// Resolve source maps to the original source
@@ -60,7 +57,12 @@ export default [
6057
},
6158
],
6259
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
63-
external: ["electron", "node:fs", "node:path"],
60+
external: [
61+
// `download@8.0.0` requires `got@^8.3.1` which then optionally requires `electron`, result in wrong dependency
62+
// Ref: https://github.com/kubernetes-client/javascript/issues/350#issue-500860208
63+
// Ref: https://github.com/kubernetes-client/javascript/issues/350#issuecomment-553644659
64+
"got",
65+
],
6466
watch: {
6567
include: "src/scripts/**",
6668
},
@@ -71,18 +73,16 @@ export default [
7173
// Allow node_modules resolution, so you can use 'external' to control
7274
// which external modules to include in the bundle
7375
// https://github.com/rollup/rollup-plugin-node-resolve#usage
74-
//resolve({
75-
// extensions: [".ts", ".js", ".json"],
76-
// preferBuiltins: false,
77-
//}),
76+
resolve({
77+
extensions: [".ts", ".js", ".json"],
78+
}),
7879

7980
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
8081
// This should be after resolve() plugin
8182
commonjs(),
8283
// Compile TypeScript files
8384
typescript({
84-
useTsconfigDeclarationDir: true,
85-
tsconfig: "tsconfig.json",
85+
useTsconfigDeclarationDir: true
8686
}),
8787

8888
// Resolve source maps to the original source

nitro-node/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"lib": [
77
"es2015",
88
"es2016",
9-
"es2017",
10-
"dom"
9+
"es2017"
1110
],
1211
"strict": true,
1312
"sourceMap": true,

0 commit comments

Comments
 (0)