2022-06-08 02:25:35 +02:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const merge = require('webpack-merge');
|
|
|
|
const common = require('./webpack.common.js');
|
|
|
|
const moment = require("dayjs");
|
2023-01-17 08:44:50 +01:00
|
|
|
const VERSION = "v0.1.1";
|
2022-11-02 05:18:40 +01:00
|
|
|
const path = require("path");
|
2022-06-08 02:25:35 +02:00
|
|
|
|
|
|
|
function makeBuildStr() {
|
|
|
|
let buildStr = moment().format("YYYYMMDD-HHmmss");
|
2022-12-27 04:17:24 +01:00
|
|
|
console.log("Prompt " + VERSION + " build " + buildStr);
|
2022-06-08 02:25:35 +02:00
|
|
|
return buildStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const BUILD = makeBuildStr();
|
|
|
|
|
|
|
|
let BundleAnalyzerPlugin = null;
|
|
|
|
if (process.env.WEBPACK_ANALYZE) {
|
|
|
|
BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
|
|
}
|
|
|
|
|
|
|
|
let merged = merge.merge(common, {
|
|
|
|
mode: "production",
|
|
|
|
output: {
|
2022-11-02 05:18:40 +01:00
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
filename: "[name].js",
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
devtool: "source-map",
|
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (BundleAnalyzerPlugin != null) {
|
|
|
|
merged.plugins.push(new BundleAnalyzerPlugin());
|
|
|
|
}
|
|
|
|
merged.plugins.push(new webpack.DefinePlugin({
|
2022-11-02 05:18:40 +01:00
|
|
|
__SHDEV__: "false",
|
2022-06-08 02:25:35 +02:00
|
|
|
__SHVERSION__: JSON.stringify(VERSION),
|
|
|
|
__SHBUILD__: JSON.stringify(BUILD),
|
|
|
|
}));
|
|
|
|
|
|
|
|
module.exports = merged;
|
|
|
|
|
|
|
|
|
|
|
|
|