diff --git a/packages/fineui/package.json b/packages/fineui/package.json index 4e8bc0b8c..79d35a2bc 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -21,7 +21,9 @@ "dist/es/case/ztree/jquery.ztree.excheck-3.5.js" ], "scripts": { - "dev": "tsc && babel src -d dist/es --config-file ./esm.babel.js -w", + "dev": "tsc && run-p dev:*", + "dev:es": "babel src -d dist/es --config-file ./esm.babel.js -w", + "dev:fineui": "webpack-dev-server --progress --config=webpack/webpack.dev.js", "build": "tsc && run-p build:*", "build:es": "babel src -d dist/es --config-file ./esm.babel.js", "build:fineui": "webpack --progress --config=webpack/webpack.prod.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({}), - ], + });