FrankChen021 commented on code in PR #19315:
URL: https://github.com/apache/druid/pull/19315#discussion_r3558729463
##########
web-console/package.json:
##########
@@ -141,24 +140,18 @@
"license-checker": "^25.0.1",
"playwright-chromium": "^1.24.1",
"postcss": "^8.4.47",
- "postcss-loader": "^5.3.0",
"postcss-preset-env": "^10.0.7",
"prettier": "^2.5.1",
"react-shallow-renderer": "^16.15.0",
"replace": "^1.2.2",
- "sass": "^1.59.3",
- "sass-loader": "^13.2.0",
+ "sass": "^1.99.0",
"snarkdown": "^2.0.0",
- "style-loader": "^2.0.0",
"stylelint": "^16.1.0",
"ts-jest": "^29.2.5",
- "ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "~5.5.4",
- "webpack": "^5.89.0",
- "webpack-bundle-analyzer": "^4.10.1",
- "webpack-cli": "^5.1.4",
- "webpack-dev-server": "^5.2.2"
+ "vite": "^8.1.4",
Review Comment:
[P1] Align the declared Node engine with Vite 8
The locked Vite version requires Node `^20.19.0 || >=22.12.0`, while the
package still advertises `>=20`; Node 20.0-20.18 users therefore satisfy the
project constraint but cannot reliably build or start the console.
##########
web-console/script/build:
##########
@@ -72,9 +72,9 @@ else
fi
if [ "$BUILD_CONSOLE" = true ]; then
- echo "Webpacking everything..."
- NODE_ENV=production ./node_modules/.bin/webpack -c webpack.config.mjs
--mode=production
+ echo "Building with Vite..."
+ NODE_ENV=production ./node_modules/.bin/vite build
Review Comment:
[P2] Keep TypeScript errors fatal during builds
`vite build` transpiles without type-checking, unlike the removed
`ts-loader` path. Maven CI runs `test-ci` without `tsc --noEmit`, allowing
errors in untested source files to be packaged.
##########
web-console/vite.config.mts:
##########
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import react from '@vitejs/plugin-react';
+import { readFileSync } from 'fs';
+import postcssPresetEnv from 'postcss-preset-env';
+import * as sass from 'sass';
+import { defineConfig } from 'vite';
+import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
+
+const version = JSON.parse(readFileSync('./package.json', 'utf-8')).version;
+
+export default defineConfig(({ mode }) => {
+ let druidUrl = process.env.druid_host || 'localhost';
+ if (!druidUrl.startsWith('http')) {
+ druidUrl = (druidUrl.endsWith(':9088') ? 'https://' : 'http://') +
druidUrl;
+ }
+ if (!/:\d+$/.test(druidUrl)) {
+ druidUrl += druidUrl.startsWith('https://') ? ':9088' : ':8888';
+ }
+
+ console.log(`Vite running in ${mode} mode.`);
+
+ return {
+ publicDir: false,
+
+ build: {
+ outDir: 'public',
+ emptyOutDir: true,
+ sourcemap: mode === 'development' ? 'inline' : false,
+ target: 'es2016',
+ cssCodeSplit: false,
+ chunkSizeWarningLimit: Infinity,
+ rollupOptions: {
+ input: 'src/entry.tsx',
+ output: {
+ entryFileNames: `web-console-${version}.js`,
+ codeSplitting: false,
+ assetFileNames: (assetInfo) => {
+ if (/\.(woff2?|ttf|eot)$/.test(assetInfo.name || '')) {
+ return 'fonts/[name][extname]';
Review Comment:
[P2] Generate font URLs under the served /public path
With Vite's default base, imported Fontsource CSS points to `/fonts/...`,
while files are emitted under `public/fonts` and Jetty exposes only
`/public/*`; production font requests will return 404.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]