mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
afc5bbd212
* phase 1 of wave runtime migration. update waveterm_dev, build vars, waveterm_app_path. fix errors with plugins readmes and screenshot directories. use asset loaders in webpack. fix window-empty styles. wave-migrate script. remove unused scripthaus commands. other fixes * waveterm_home directory. lots of internal scbase prompt names to wave * update waveterm.lock file * change wave data directories. remove welcome modal code * update waveterm.db name * fix Wave menu (add back default items). Update TOS modal words * fix typescript errors
104 lines
3.4 KiB
JavaScript
104 lines
3.4 KiB
JavaScript
const webpack = require("webpack");
|
|
const webpackMerge = require("webpack-merge");
|
|
const path = require("path");
|
|
const moment = require("dayjs");
|
|
const VERSION = require("../version.js");
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
function makeBuildStr() {
|
|
let buildStr = moment().format("YYYYMMDD-HHmmss");
|
|
// console.log("waveterm:electron " + VERSION + " build " + buildStr);
|
|
return buildStr;
|
|
}
|
|
|
|
const BUILD = makeBuildStr();
|
|
|
|
var electronCommon = {
|
|
entry: {
|
|
emain: ["./src/electron/emain.ts"],
|
|
},
|
|
target: "electron-main",
|
|
externals: {
|
|
fs: "require('fs')",
|
|
"fs-ext": "require('fs-ext')",
|
|
},
|
|
devtool: "source-map",
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
// exclude: /node_modules/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
options: {
|
|
presets: [
|
|
[
|
|
"@babel/preset-env",
|
|
{
|
|
targets:
|
|
"defaults and not ie > 0 and not op_mini all and not op_mob > 0 and not kaios > 0 and not and_qq > 0 and not and_uc > 0 and not baidu > 0",
|
|
},
|
|
],
|
|
"@babel/preset-react",
|
|
"@babel/preset-typescript",
|
|
],
|
|
plugins: [
|
|
["@babel/transform-runtime", { regenerator: true }],
|
|
"@babel/plugin-transform-react-jsx",
|
|
["@babel/plugin-proposal-decorators", { legacy: true }],
|
|
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
|
"babel-plugin-jsx-control-statements",
|
|
],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
extensions: [".ts", ".tsx", ".js"],
|
|
},
|
|
};
|
|
|
|
var electronDev = webpackMerge.merge(electronCommon, {
|
|
mode: "development",
|
|
output: {
|
|
path: path.resolve(__dirname, "../dist-dev"),
|
|
filename: "[name].js",
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [{ from: "src/electron/preload.js", to: "preload.js" }],
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
__WAVETERM_DEV__: "true",
|
|
__WAVETERM_VERSION__: JSON.stringify(VERSION),
|
|
__WAVETERM_BUILD__: JSON.stringify("devbuild"),
|
|
}),
|
|
],
|
|
});
|
|
|
|
var electronProd = webpackMerge.merge(electronCommon, {
|
|
mode: "production",
|
|
output: {
|
|
path: path.resolve(__dirname, "../dist"),
|
|
filename: "[name].js",
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [{ from: "src/electron/preload.js", to: "preload.js" }],
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
__WAVETERM_DEV__: "false",
|
|
__WAVETERM_VERSION__: JSON.stringify(VERSION),
|
|
__WAVETERM_BUILD__: JSON.stringify(BUILD),
|
|
}),
|
|
],
|
|
optimization: {
|
|
minimize: true,
|
|
},
|
|
});
|
|
|
|
module.exports = {electronDev: electronDev, electronProd: electronProd};
|