Browse Source

Pull request #3507: KERNEL-14316 chore:加个开发模式

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit '721d5bbdd9481bd195de0bc69d3f616583999c96':
  KERNEL-14316 chore:打包调整
es6
treecat-罗群 2 years ago
parent
commit
99b7d255c1
  1. 4
      packages/fineui/package.json
  2. 8
      packages/fineui/webpack/webpack.common.js
  3. 34
      packages/fineui/webpack/webpack.dev.js
  4. 7
      packages/fineui/webpack/webpack.prod.js

4
packages/fineui/package.json

@ -21,7 +21,9 @@
"dist/es/case/ztree/jquery.ztree.excheck-3.5.js" "dist/es/case/ztree/jquery.ztree.excheck-3.5.js"
], ],
"scripts": { "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": "tsc && run-p build:*",
"build:es": "babel src -d dist/es --config-file ./esm.babel.js", "build:es": "babel src -d dist/es --config-file ./esm.babel.js",
"build:fineui": "webpack --progress --config=webpack/webpack.prod.js" "build:fineui": "webpack --progress --config=webpack/webpack.prod.js"

8
packages/fineui/webpack/webpack.common.js

@ -4,6 +4,7 @@ const path = require("path");
const fs = require("fs"); const fs = require("fs");
const dirs = require("./dirs"); const dirs = require("./dirs");
const attachments = require("./attachments"); const attachments = require("./attachments");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
let lessVariables = {}; let lessVariables = {};
if (process.env.LESS_CONFIG_PATH) { if (process.env.LESS_CONFIG_PATH) {
@ -86,4 +87,11 @@ module.exports = {
}, },
], ],
}, },
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new ForkTsCheckerWebpackPlugin({}),
],
}; };

34
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" }],
},
},
});

7
packages/fineui/webpack/webpack.prod.js

@ -51,10 +51,5 @@ module.exports = merge(common, {
], ],
}, },
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new ForkTsCheckerWebpackPlugin({}),
],
}); });

Loading…
Cancel
Save