chore: add version env

pull/13/head
moonrailgun 4 years ago
parent aa9d15e2e4
commit 8358d2aa7c

@ -93,5 +93,10 @@ export {
datetimeToNow,
datetimeFromNow,
} from './utils/date-helper';
export { isBrowser, isNavigator, isDevelopment } from './utils/environment';
export {
isBrowser,
isNavigator,
isDevelopment,
version,
} from './utils/environment';
export { getTextColorHex } from './utils/string-helper';

@ -3,3 +3,5 @@ export const isBrowser = typeof window !== 'undefined';
export const isNavigator = typeof navigator !== 'undefined';
export const isDevelopment = process.env.NODE_ENV === 'development';
export const version = process.env.VERSION || '0.0.0';

@ -1,7 +1,8 @@
import { isDevelopment, request } from 'tailchat-shared';
import { isDevelopment, request, version } from 'tailchat-shared';
if (isDevelopment === true) {
(window as any).DEBUG = {
request,
version,
};
}

@ -16,6 +16,8 @@ require('dotenv').config();
delete process.env.TS_NODE_PROJECT; // https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/32
require('../build/script/buildPublicTranslation.js'); // 编译前先执行一下构建翻译的脚本
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('./package.json');
const ROOT_PATH = path.resolve(__dirname, './');
const DIST_PATH = path.resolve(ROOT_PATH, './dist');
@ -109,6 +111,7 @@ const config: Configuration = {
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.SERVICE_URL': JSON.stringify(process.env.SERVICE_URL),
'process.env.VERSION': JSON.stringify(packageJson.version),
}),
new HtmlWebpackPlugin({
title: 'TailChat',

Loading…
Cancel
Save