Skip to content

Commit

Permalink
build: add KUBESPHERE_EDITION constant to config files (#4304)
Browse files Browse the repository at this point in the history
Signed-off-by: donniean <donniean1@gmail.com>
  • Loading branch information
donniean committed Sep 19, 2024
1 parent 04d220f commit a8e619e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/bootstrap/webpack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

const path = require('path');

const KUBESPHERE_EDITION = 'ks';

const resolve = absolutePath => path.resolve(process.cwd(), absolutePath);

const rootDir = path.resolve(__dirname, '../');
Expand Down Expand Up @@ -46,4 +48,4 @@ const systemImports = {

const locales = ['ar', 'en', 'es', 'fr', 'hi', 'ko', 'lt', 'pl', 'tc', 'tr', 'zh'];

module.exports = { config, systemImports, locales };
module.exports = { config, systemImports, locales, KUBESPHERE_EDITION };
4 changes: 2 additions & 2 deletions packages/bootstrap/webpack/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

const fs = require('fs-extra');
const { config, systemImports } = require('./config');
const { config, systemImports, KUBESPHERE_EDITION } = require('./config');
const webpack = require('webpack');
const WebpackBar = require('webpackbar');
const { merge } = require('webpack-merge');
Expand Down Expand Up @@ -89,7 +89,7 @@ const webpackBaseConfig = merge(configs, {
},
plugins: [
new webpack.DefinePlugin({
'process.env.KUBESPHERE_EDITION': JSON.stringify('ks'),
'process.env.KUBESPHERE_EDITION': JSON.stringify(KUBESPHERE_EDITION),
}),
new ForkTsCheckerWebpackPlugin(),
new CopyWebpackPlugin({
Expand Down
5 changes: 4 additions & 1 deletion packages/bootstrap/webpack/webpack.dll.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const WebpackBar = require('webpackbar');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { config: configShared } = require('./config');
const { config: configShared, KUBESPHERE_EDITION } = require('./config');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const resolveShared = configShared.resolve;
const absResolve = configShared.absResolve;
Expand Down Expand Up @@ -91,6 +91,9 @@ const config = {
minimizer: [new TerserPlugin()],
},
plugins: [
new webpack.DefinePlugin({
'process.env.KUBESPHERE_EDITION': JSON.stringify(KUBESPHERE_EDITION),
}),
new WebpackBar({
name: 'build dll',
color: 'green',
Expand Down

0 comments on commit a8e619e

Please sign in to comment.