From 9fffb7bac5c51f4acd7868a40f4b66bdba9af98a Mon Sep 17 00:00:00 2001 From: Treecat Date: Mon, 24 Apr 2023 11:18:39 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14316=20chore:=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/webpack/webpack.common.js | 8 ++++++ packages/fineui/webpack/webpack.dev.js | 34 +++++++++++++++++++++++ packages/fineui/webpack/webpack.prod.js | 7 +---- 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 packages/fineui/webpack/webpack.dev.js diff --git a/packages/fineui/webpack/webpack.common.js b/packages/fineui/webpack/webpack.common.js index c6efd9d46..30a2983b1 100644 --- a/packages/fineui/webpack/webpack.common.js +++ b/packages/fineui/webpack/webpack.common.js @@ -4,6 +4,7 @@ const path = require("path"); const fs = require("fs"); const dirs = require("./dirs"); const attachments = require("./attachments"); +const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); let lessVariables = {}; if (process.env.LESS_CONFIG_PATH) { @@ -86,4 +87,11 @@ module.exports = { }, ], }, + + plugins: [ + new MiniCssExtractPlugin({ + filename: "[name].css", + }), + new ForkTsCheckerWebpackPlugin({}), + ], }; diff --git a/packages/fineui/webpack/webpack.dev.js b/packages/fineui/webpack/webpack.dev.js new file mode 100644 index 000000000..c0bb360fe --- /dev/null +++ b/packages/fineui/webpack/webpack.dev.js @@ -0,0 +1,34 @@ +const webpack = require("webpack"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const TerserPlugin = require("terser-webpack-plugin"); +const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); +const common = require("./webpack.common.js"); +const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); +const childProcess = require("child_process"); +const { merge } = require("webpack-merge"); +const dirs = require("./dirs"); +const attachments = require("./attachments"); +const path = require("path"); + +function git(command) { + return childProcess.execSync(`git ${command}`).toString().trim(); +} + +module.exports = merge(common, { + mode: "development", + + devtool: "inline-source-map", + + output: { + path: dirs.DEST, + filename: "[name].js", + }, + + devServer: { + port: 9001, + liveReload: true, + historyApiFallback: { + rewrites: [{ from: /.*/, to: "/index.html" }], + }, + }, +}); diff --git a/packages/fineui/webpack/webpack.prod.js b/packages/fineui/webpack/webpack.prod.js index 36aa0544a..329835729 100644 --- a/packages/fineui/webpack/webpack.prod.js +++ b/packages/fineui/webpack/webpack.prod.js @@ -51,10 +51,5 @@ module.exports = merge(common, { ], }, - plugins: [ - new MiniCssExtractPlugin({ - filename: "[name].css", - }), - new ForkTsCheckerWebpackPlugin({}), - ], + });