|
|
@ -4,7 +4,11 @@ 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 CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); |
|
|
|
|
|
|
|
const childProcess = require("child_process"); |
|
|
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); |
|
|
|
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin"); |
|
|
|
|
|
|
|
const webpack = require("webpack"); |
|
|
|
|
|
|
|
const TerserPlugin = require("terser-webpack-plugin"); |
|
|
|
|
|
|
|
|
|
|
|
let lessVariables = {}; |
|
|
|
let lessVariables = {}; |
|
|
|
if (process.env.LESS_CONFIG_PATH) { |
|
|
|
if (process.env.LESS_CONFIG_PATH) { |
|
|
@ -14,6 +18,10 @@ if (process.env.LESS_CONFIG_PATH) { |
|
|
|
lessVariables = fs.existsSync(lessConfigPath) ? require(lessConfigPath) || {} : {}; |
|
|
|
lessVariables = fs.existsSync(lessConfigPath) ? require(lessConfigPath) || {} : {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function git(command) { |
|
|
|
|
|
|
|
return childProcess.execSync(`git ${command}`).toString().trim(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
module.exports = { |
|
|
|
entry: { |
|
|
|
entry: { |
|
|
|
fineui: attachments.fineui, |
|
|
|
fineui: attachments.fineui, |
|
|
@ -94,4 +102,28 @@ module.exports = { |
|
|
|
}), |
|
|
|
}), |
|
|
|
new ForkTsCheckerWebpackPlugin({}), |
|
|
|
new ForkTsCheckerWebpackPlugin({}), |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
optimization: { |
|
|
|
|
|
|
|
usedExports: false, |
|
|
|
|
|
|
|
minimize: true, |
|
|
|
|
|
|
|
minimizer: [ |
|
|
|
|
|
|
|
new TerserPlugin({ |
|
|
|
|
|
|
|
include: /\.min/, |
|
|
|
|
|
|
|
parallel: true, |
|
|
|
|
|
|
|
terserOptions: { |
|
|
|
|
|
|
|
format: { |
|
|
|
|
|
|
|
comments: /\/*! time:(.*?); branch:(.*?); commit:(.*?)/, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
new webpack.BannerPlugin({ |
|
|
|
|
|
|
|
banner: `time: ${new Date().toLocaleString("en-US")}; branch: ${git( |
|
|
|
|
|
|
|
'name-rev --name-only HEAD' |
|
|
|
|
|
|
|
)}; commit: ${git( |
|
|
|
|
|
|
|
'rev-parse HEAD' |
|
|
|
|
|
|
|
)}` |
|
|
|
|
|
|
|
}), |
|
|
|
|
|
|
|
new CssMinimizerPlugin(), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|