forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
59 lines
1.7 KiB
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"); |
|
|
|
function git(command) { |
|
return childProcess.execSync(`git ${command}`).toString().trim(); |
|
} |
|
|
|
module.exports = merge(common, { |
|
mode: "production", |
|
|
|
entry: { |
|
"fineui.min": attachments.fineui |
|
}, |
|
|
|
output: { |
|
path: dirs.DEST, |
|
filename: "[name].js", |
|
}, |
|
|
|
devtool: "hidden-source-map", |
|
|
|
optimization: { |
|
usedExports: false, |
|
minimize: true, |
|
minimizer: [ |
|
new TerserPlugin({ |
|
include: /\.min/, |
|
parallel: true, |
|
terserOptions: { |
|
output: { |
|
comments: false, |
|
}, |
|
}, |
|
}), |
|
new webpack.BannerPlugin({ |
|
banner: `time: ${new Date().toLocaleString()}; branch: ${git( |
|
"name-rev --name-only HEAD" |
|
)} commit: ${git("rev-parse HEAD")}`, |
|
}), |
|
new CssMinimizerPlugin(), |
|
], |
|
}, |
|
|
|
|
|
plugins: [ |
|
new MiniCssExtractPlugin({ |
|
filename: "[name].css", |
|
}), |
|
new ForkTsCheckerWebpackPlugin({}), |
|
], |
|
});
|
|
|