Browse Source

chore: 打包优化

master
iapyang 5 years ago
parent
commit
49ec69c63c
  1. 7
      lib/postbuild/postbuild.js
  2. 25
      webpack/webpack.prod.js

7
lib/postbuild/postbuild.js

@ -15,7 +15,9 @@ function unionJs(filenames) {
); );
}); });
concat.add(null, `//# sourceMappingURL=${filename}.map`); const filenameParts = filename.split("/");
concat.add(null, `//# sourceMappingURL=${filenameParts[filenameParts.length - 1]}.map`);
var concatenatedContent = concat.content; var concatenatedContent = concat.content;
var sourceMapForContent = concat.sourceMap; var sourceMapForContent = concat.sourceMap;
@ -33,4 +35,5 @@ unionJs(["bundle.min.js", "fineui.typescript.js"]);
unionJs(["bundle.ie.min.js", "fineui.typescript.ie.js"]); unionJs(["bundle.ie.min.js", "fineui.typescript.ie.js"]);
unionJs(["fineui.min.js", "fineui.typescript.js"]); unionJs(["fineui.min.js", "fineui.typescript.js"]);
unionJs(["fineui.ie.min.js", "fineui.typescript.ie.js"]); unionJs(["fineui.ie.min.js", "fineui.typescript.ie.js"]);
// unionJs(["bundle.min.js", "fineui.typescript.js"]); unionJs(["2.0/fineui.min.js", "fineui.typescript.js"]);
unionJs(["2.0/fineui.ie.min.js", "fineui.typescript.ie.js"]);

25
webpack/webpack.prod.js

@ -13,6 +13,20 @@ const common = require("./webpack.common.js");
module.exports = merge.smart(common, { module.exports = merge.smart(common, {
mode: "production", mode: "production",
optimization: {
minimizer: [
new UglifyJsPlugin({
parallel: true,
sourceMap: true,
uglifyOptions: {
ie8: true,
output: {
comments: false,
},
}
})
]
},
devtool: "hidden-source-map", devtool: "hidden-source-map",
@ -26,17 +40,6 @@ module.exports = merge.smart(common, {
path: dirs.DEST, path: dirs.DEST,
filename: "fineui.typescript.css", filename: "fineui.typescript.css",
}), }),
new UglifyJsPlugin({
test: /\.js(\?.*)?$/i,
parallel: true,
sourceMap: true,
uglifyOptions: {
ie8: true,
output: {
comments: false,
},
},
}),
new webpack.BannerPlugin({ new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString()}`, banner: `time: ${new Date().toLocaleString()}`,
}), }),

Loading…
Cancel
Save