fineui是帆软报表和BI产品线所使用的前端框架。
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.

128 lines
4.2 KiB

const webpack = require("webpack");
const merge = require("webpack-merge");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const TerserJsPlugin = require("terser-webpack-plugin");
const dirs = require("./dirs");
const common = require("./webpack.common.js");
const attachments = require("./attachments");
3 years ago
const components = require("./components");
const childProcess = require('child_process');
function git(command) {
return childProcess
.execSync(`git ${command}`)
.toString()
.trim();
}
module.exports = merge.smart(common, {
mode: "production",
entry: {
font: attachments.font,
"fineui.min": attachments.fineui,
3 years ago
"fineui_without_normalize.min": attachments.fineuiWithoutNormalize,
"fineui_without_conflict.min": attachments.fineuiWithoutConflict,
"fineui.proxy.min": attachments.fineuiProxy,
3 years ago
"core_without_platform": attachments.coreWithoutPlatform,
utils: attachments.utils,
"utils.min": attachments.utils,
"fineui_without_jquery_polyfill": attachments.fineuiWithoutJqueryAndPolyfillJs,
"fineui_without_jquery_polyfill.min": attachments.fineuiWithoutJqueryAndPolyfillJs,
"2.0/fineui": attachments.bundle,
"2.0/fineui.min": attachments.bundle,
3 years ago
"2.0/fineui_without_normalize": attachments.bundleWithoutNormalize,
"2.0/fineui_without_normalize.min": attachments.bundleWithoutNormalize,
"2.0/core_without_platform": attachments.coreWithoutPlatform,
"2.0/core_without_platform.min": attachments.coreWithoutPlatform,
core: attachments.coreJs,
resource: attachments.resource,
3 years ago
"lib/single": components.single,
3 years ago
"lib/layers": components.layer,
"lib/pane": components.pane,
3 years ago
"lib/button_group": components.button_group,
"lib/buttons": components.buttons,
3 years ago
"lib/checkboxes": components.checkboxes,
3 years ago
"lib/combos": components.combos,
"lib/editors": components.editors,
"lib/triggers": components.triggers,
"lib/calendar": components.calendar,
"lib/color_chooser": components.color_chooser,
"lib/segment": components.segment,
"lib/linear_segment": components.linear_segment,
"lib/date": components.date,
"lib/down_list": components.down_list,
"lib/text_value_down_list_combo": components.text_value_down_list_combo,
},
optimization: {
minimizer: [
new TerserJsPlugin({
include: /\.min/,
parallel: true,
sourceMap: true,
terserOptions: {
output: {
3 years ago
comments: false
}
}
}),
new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString()}; branch: ${git(
'rev-parse --abbrev-ref HEAD'
)} commit: ${git(
'rev-parse HEAD'
)}`
3 years ago
})
]
},
devtool: "hidden-source-map",
output: {
path: dirs.DEST,
3 years ago
filename: "[name].js"
},
plugins: [
new MiniCssExtractPlugin({
path: dirs.DEST,
3 years ago
filename: "[name].css"
}),
new ForkTsCheckerWebpackPlugin({}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: require("cssnano"),
cssProcessorPluginOptions: {
preset: ["default", {
discardComments: {
3 years ago
removeAll: true
},
3 years ago
normalizeUnicode: false
}]
},
3 years ago
canPrint: true
})
],
module: {
rules: [
{
test: /\.(css|less)$/,
use: [
{
loader: "postcss-loader",
options: {
3 years ago
plugins: []
}
}
]
}
]
}
});