Skip to content

Commit

Permalink
feat: add net and tls browserify support in webpack configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-zahedi committed Mar 4, 2025
1 parent 1ebdd0a commit c273147
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/many-chefs-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gdu': patch
---

gdu: add net and tls browserify support in webpack configuration
10 changes: 9 additions & 1 deletion packages/gdu/config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Configuration,
DefinePlugin,
IgnorePlugin,
ProvidePlugin,
SourceMapDevToolPlugin,
} from 'webpack';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
Expand Down Expand Up @@ -162,9 +163,12 @@ export const baseOptions = ({
fallback: {
path: false,
util: false,
net: false,
tls: false,
zlib: require.resolve('browserify-zlib'),
buffer: require.resolve('buffer/'),
stream: require.resolve('stream-browserify'),
https: require.resolve("https-browserify"),
assert: require.resolve('assert/'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
Expand Down Expand Up @@ -455,7 +459,11 @@ export const baseOptions = ({
analyzerMode: 'static',
reportFilename: 'bundle-report.html',
openAnalyzer: false,
}),
}),
new ProvidePlugin({
net: 'net',
tls: 'tls',
}),
].filter(Boolean),
target: 'es2020',
output: {
Expand Down
3 changes: 3 additions & 0 deletions packages/gdu/config/webpack/webpack.development.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ export const baseDevelopmentOptions = ({
fallback: {
path: false,
util: false,
net: false,
tls: false,
zlib: require.resolve('browserify-zlib'),
buffer: require.resolve('buffer/'),
stream: require.resolve('stream-browserify'),
https: require.resolve("https-browserify"),
assert: require.resolve('assert/'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
Expand Down
2 changes: 2 additions & 0 deletions packages/gdu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"kleur": "^4.1.4",
"mini-css-extract-plugin": "^2.4.2",
"mkdirp": "^1.0.4",
"net": "1.0.2",
"next": "^14.2.3",
"node-fetch": "^2.6.1",
"node-static": "^0.7.11",
Expand All @@ -91,6 +92,7 @@
"subscriptions-transport-ws": "^0.11.0",
"tapable": "^2.2.0",
"terser-webpack-plugin": "^5.3.11",
"tls-browserify": "0.2.2",
"treat": "2.0.4",
"ts-dedent": "^2.2.0",
"tsconfig-paths-webpack-plugin": "^3.5.2",
Expand Down
25 changes: 25 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10074,6 +10074,7 @@ __metadata:
kleur: ^4.1.4
mini-css-extract-plugin: ^2.4.2
mkdirp: ^1.0.4
net: 1.0.2
next: ^14.2.3
node-fetch: ^2.6.1
node-static: ^0.7.11
Expand All @@ -10092,6 +10093,7 @@ __metadata:
subscriptions-transport-ws: ^0.11.0
tapable: ^2.2.0
terser-webpack-plugin: ^5.3.11
tls-browserify: 0.2.2
treat: 2.0.4
ts-dedent: ^2.2.0
tsconfig-paths-webpack-plugin: ^3.5.2
Expand Down Expand Up @@ -14097,6 +14099,13 @@ __metadata:
languageName: node
linkType: hard

"net@npm:1.0.2":
version: 1.0.2
resolution: "net@npm:1.0.2"
checksum: d97e215d922e87e9aa86e87daae73ce7f4e291f2d71365a115f2f51831b1add86e73584e944285daafcad4058c09bb85e33250da84834a26a83020740d45b4a1
languageName: node
linkType: hard

"next-tick@npm:^1.1.0":
version: 1.1.0
resolution: "next-tick@npm:1.1.0"
Expand Down Expand Up @@ -14227,6 +14236,13 @@ __metadata:
languageName: node
linkType: hard

"node-forge@npm:^0.7.0":
version: 0.7.6
resolution: "node-forge@npm:0.7.6"
checksum: 661d420847da736d82f3aad0e8ad2b5fceddc4bd5f4065b923c566e9fd68e568509677374f101c1f4321c541dcbef0864516a2a55ff03a9236d0895195dfa7aa
languageName: node
linkType: hard

"node-forge@npm:^1":
version: 1.3.1
resolution: "node-forge@npm:1.3.1"
Expand Down Expand Up @@ -18800,6 +18816,15 @@ __metadata:
languageName: node
linkType: hard

"tls-browserify@npm:0.2.2":
version: 0.2.2
resolution: "tls-browserify@npm:0.2.2"
dependencies:
node-forge: ^0.7.0
checksum: 7c639ae2c33c806737bd1810a1933dab73ecbb938e0f370b810443b87ca07e329c2cd36af1a2ac56424b7fb045769cd8a9ac6c07f1aacad72fe7693c40583937
languageName: node
linkType: hard

"tmp@npm:0.0.x, tmp@npm:^0.0.33":
version: 0.0.33
resolution: "tmp@npm:0.0.33"
Expand Down

0 comments on commit c273147

Please sign in to comment.