Skip to content

Commit ea96633

Browse files
igorDykhtaIhor Dykhta
andauthored
chore: upgrade to webpack 5 (#3587)
* chore: bump to webpack 5 Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix yarn start Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * bundle size opt Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * follow up Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * dedupe mapbox in bundle Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix headless tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * fix headless tests Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * nit Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> * follow up Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> --------- Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local> Co-authored-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
1 parent 952d7c4 commit ea96633

36 files changed

Lines changed: 2365 additions & 2008 deletions

File tree

package.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"build:umd": "node ./esbuild/umd-esbuild.config.mjs",
7979
"build:types": "tsc --project tsconfig.production.json",
8080
"analyze": "yarn analyze:bundle",
81-
"analyze:bundle": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/bundle.js --progress --env.prod",
81+
"analyze:bundle": "webpack --config ./webpack/bundle.js --progress --env prod",
8282
"check-licence": "babel-node ./scripts/license-header/bin --license ./FILE-HEADER --dry",
8383
"add-licence": "babel-node ./scripts/license-header/bin --license ./FILE-HEADER",
8484
"prepublishOnly": "yarn workspaces foreach -At run stab && yarn workspaces foreach -At run prepublishOnly && yarn add-licence && yarn build:umd && yarn build:types",
@@ -105,7 +105,7 @@
105105
"@kepler.gl/components": "3.3.0-alpha.3",
106106
"@loaders.gl/polyfills": "^4.4.1",
107107
"@types/mapbox__geo-viewport": "^0.4.1",
108-
"html-webpack-plugin": "^4.3.0",
108+
"html-webpack-plugin": "^5.6.3",
109109
"math.gl": "^4.1.0",
110110
"monaco-editor": "^0.52.0",
111111
"typedoc": "^0.19.2"
@@ -148,18 +148,23 @@
148148
"@types/d3-scale": "^3.2.2",
149149
"@types/geojson": "^7946.0.8",
150150
"@types/jsdom": "^21.1.1",
151+
"@types/path-browserify": "^1",
151152
"@types/redux-actions": "^2.6.2",
152153
"@types/redux-logger": "^3",
153154
"@types/supercluster": "^7.1.0",
154155
"@typescript-eslint/eslint-plugin": "5.57.0",
155156
"@typescript-eslint/parser": "^5.57.1",
157+
"assert": "^1.4.0",
156158
"babel-loader": "^8.0.0",
157159
"babel-plugin-istanbul": "^6.0.0",
158160
"babel-plugin-module-resolver": "^4.0.0",
159161
"babel-plugin-search-and-replace": "^1.0.0",
160162
"babel-plugin-styled-components": "^2.1.4",
161163
"babel-plugin-transform-builtin-extend": "^1.1.0",
162164
"babelify": "^10.0.0",
165+
"browserify-zlib": "^0.2.0",
166+
"buffer": "^6.0.3",
167+
"crypto-browserify": "^3.12.1",
163168
"css-loader": "5.2.7",
164169
"documentation": "^9.1.1",
165170
"dts-bundle-webpack": "^1.0.2",
@@ -187,7 +192,10 @@
187192
"maplibre-gl": "^4.0.0",
188193
"minimist": "^1.2.6",
189194
"nyc": "^15.1.0",
195+
"os-browserify": "^0.3.0",
196+
"path-browserify": "^1.0.1",
190197
"prettier": "2.8.8",
198+
"process": "^0.11.10",
191199
"progress-bar-webpack-plugin": "^2.1.0",
192200
"puppeteer": "^24.7.1",
193201
"react": "^19.0.0",
@@ -197,7 +205,8 @@
197205
"redux-mock-store": "^1.2.1",
198206
"sinon": "^2.4.1",
199207
"sinon-stub-promise": "^4.0.0",
200-
"source-map-loader": "^1.1.1",
208+
"source-map-loader": "^5.0.0",
209+
"stream-browserify": "^3.0.0",
201210
"style-loader": "2.0.0",
202211
"styled-components": "6.4.3",
203212
"stylelint": "^13.6.1",
@@ -211,12 +220,13 @@
211220
"typescript": "5.6.3",
212221
"url-loader": "^4.1.1",
213222
"usehooks-ts": "^3.1.0",
223+
"util": "^0.12.5",
214224
"watchify": "^3.6.1",
215-
"webpack": "^4.29.0",
216-
"webpack-bundle-analyzer": "^3.3.2",
217-
"webpack-cli": "^3.2.1",
218-
"webpack-dev-middleware": "^3.5.1",
219-
"webpack-dev-server": "^3.1.14",
225+
"webpack": "^5.104.1",
226+
"webpack-bundle-analyzer": "^4.10.2",
227+
"webpack-cli": "^5.1.4",
228+
"webpack-dev-middleware": "^7.4.2",
229+
"webpack-dev-server": "^5.2.6",
220230
"webpack-hot-middleware": "^2.24.3",
221231
"webpack-stats-plugin": "^0.2.1"
222232
},

src/actions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/ai-assistant/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/cloud-providers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/cloud-providers/webpack/umd.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ const join = require('path').join;
66

77
// Import package.json to read version
88
const KeplerPackage = require('../package');
9+
const webpack = require('webpack');
910

1011
const SRC_DIR = resolve(__dirname, '../src');
1112
const OUTPUT_DIR = resolve(__dirname, '../umd');
1213

1314
const LIBRARY_BUNDLE_CONFIG = () => ({
15+
mode: 'production',
16+
1417
entry: {
1518
KeplerGl: join(SRC_DIR, 'index.ts')
1619
},
@@ -68,10 +71,20 @@ const LIBRARY_BUNDLE_CONFIG = () => ({
6871
},
6972
resolve: {
7073
extensions: ['.tsx', '.ts', '.js'],
71-
modules: ['node_modules', SRC_DIR]
74+
modules: ['node_modules', SRC_DIR],
75+
fallback: {
76+
fs: false
77+
}
7278
},
7379
module: {
7480
rules: [
81+
{
82+
// webpack 5 requires explicit opt-out for node_modules that use
83+
// extension-less relative imports in strict ESM context.
84+
test: /\.m?js$/,
85+
include: [/node_modules/],
86+
resolve: {fullySpecified: false}
87+
},
7588
{
7689
test: /\.(js|ts|tsx)$/,
7790
loader: 'babel-loader',
@@ -95,9 +108,11 @@ const LIBRARY_BUNDLE_CONFIG = () => ({
95108
]
96109
},
97110

98-
node: {
99-
fs: 'empty'
100-
}
111+
plugins: [
112+
new webpack.ProvidePlugin({
113+
process: require.resolve('process/browser')
114+
})
115+
]
101116
});
102117

103118
module.exports = env => LIBRARY_BUNDLE_CONFIG(env);

src/common-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && ../../node_modules/.bin/babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/constants/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:umd && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

src/constants/webpack/umd.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ const join = require('path').join;
66

77
// Import package.json to read version
88
const KeplerPackage = require('../package');
9+
const webpack = require('webpack');
910

1011
const SRC_DIR = resolve(__dirname, '../src');
1112
const OUTPUT_DIR = resolve(__dirname, '../umd');
1213

1314
const LIBRARY_BUNDLE_CONFIG = () => ({
15+
mode: 'production',
16+
1417
entry: {
1518
KeplerGl: join(SRC_DIR, 'index.ts')
1619
},
@@ -68,10 +71,20 @@ const LIBRARY_BUNDLE_CONFIG = () => ({
6871
},
6972
resolve: {
7073
extensions: ['.tsx', '.ts', '.js'],
71-
modules: ['node_modules', SRC_DIR]
74+
modules: ['node_modules', SRC_DIR],
75+
fallback: {
76+
fs: false
77+
}
7278
},
7379
module: {
7480
rules: [
81+
{
82+
// webpack 5 requires explicit opt-out for node_modules that use
83+
// extension-less relative imports in strict ESM context.
84+
test: /\.m?js$/,
85+
include: [/node_modules/],
86+
resolve: {fullySpecified: false}
87+
},
7588
{
7689
test: /\.(js|ts|tsx)$/,
7790
loader: 'babel-loader',
@@ -95,9 +108,11 @@ const LIBRARY_BUNDLE_CONFIG = () => ({
95108
]
96109
},
97110

98-
node: {
99-
fs: 'empty'
100-
}
111+
plugins: [
112+
new webpack.ProvidePlugin({
113+
process: require.resolve('process/browser')
114+
})
115+
]
101116
});
102117

103118
module.exports = env => LIBRARY_BUNDLE_CONFIG(env);

src/deckgl-arrow-layers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"scripts": {
2222
"build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
23-
"build:umd": "NODE_OPTIONS=--openssl-legacy-provider webpack --config ./webpack/umd.js --progress --env.prod",
23+
"build:umd": "webpack --config ./webpack/umd.js --progress --env prod",
2424
"build:types": "tsc --project ./tsconfig.production.json",
2525
"prepublishOnly": "babel-node ../../scripts/license-header/bin --license ../../FILE-HEADER && yarn build && yarn build:types",
2626
"stab": "mkdir -p dist && touch dist/index.js"

0 commit comments

Comments
 (0)