set console asset version as build timestamp (#2742)

This commit is contained in:
Rikin Kachhia 2019-08-19 14:40:41 +05:30 committed by GitHub
parent 3527b085fd
commit 47057989af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View File

@ -20,12 +20,6 @@ const webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(
// const { UnusedFilesWebpackPlugin } = require('unused-files-webpack-plugin');
const getRandomHexString = () => {
return Math.random()
.toString(16)
.slice(2);
};
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
@ -155,7 +149,7 @@ module.exports = {
}),
// set global consts
new webpack.DefinePlugin({
CONSOLE_ASSET_VERSION: JSON.stringify(getRandomHexString()),
CONSOLE_ASSET_VERSION: Date.now().toString(),
}),
webpackIsomorphicToolsPlugin.development(),
],

View File

@ -22,12 +22,6 @@ const cleanOptions = {
dry: false,
};
const getRandomHexString = () => {
return Math.random()
.toString(16)
.slice(2);
};
module.exports = {
mode: 'production',
context: path.resolve(__dirname, '..'),
@ -193,7 +187,7 @@ module.exports = {
// Useful to reduce the size of client-side libraries, e.g. react
NODE_ENV: JSON.stringify('production'),
},
CONSOLE_ASSET_VERSION: JSON.stringify(getRandomHexString()),
CONSOLE_ASSET_VERSION: Date.now().toString(),
}),
],
};