Browse Source

chore: 优化打包

es6
iapyang 5 years ago
parent
commit
c55cdccb15
  1. 4
      dist/2.0/fineui.ie.js
  2. 2
      dist/2.0/fineui.ie.js.map
  3. 4
      dist/2.0/fineui.ie.min.js
  4. 2
      dist/2.0/fineui.ie.min.js.map
  5. 4
      dist/2.0/fineui.js
  6. 2
      dist/2.0/fineui.js.map
  7. 4
      dist/2.0/fineui.min.js
  8. 2
      dist/2.0/fineui.min.js.map
  9. 4
      dist/bundle.ie.js
  10. 2
      dist/bundle.ie.js.map
  11. 4
      dist/bundle.min.js
  12. 2
      dist/bundle.min.js.map
  13. 1
      dist/demo.css
  14. 3
      dist/demo.js
  15. 1
      dist/demo.js.map
  16. 4
      dist/fineui.ie.js
  17. 2
      dist/fineui.ie.js.map
  18. 4
      dist/fineui.js
  19. 2
      dist/fineui.js.map
  20. 4
      dist/fineui.min.js
  21. 2
      dist/fineui.min.js.map
  22. 4
      dist/fineui_without_jquery_polyfill.js
  23. 2
      dist/fineui_without_jquery_polyfill.js.map
  24. 4
      dist/utils.js
  25. 2
      dist/utils.js.map
  26. 4
      dist/utils.min.js
  27. 2
      dist/utils.min.js.map
  28. 39
      index.html
  29. 97
      lib/postbuild/postbuild.js
  30. 22
      package.json
  31. 12
      template/index.html
  32. 243
      webpack/attachments.js
  33. 33
      webpack/webpack.common.js
  34. 8
      webpack/webpack.dev.js
  35. 46
      webpack/webpack.prod.js
  36. 790
      yarn.lock

4
dist/2.0/fineui.ie.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.ie.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/2.0/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.ie.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.ie.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/bundle.min.js.map vendored

File diff suppressed because one or more lines are too long

1
dist/demo.css vendored

File diff suppressed because one or more lines are too long

3
dist/demo.js vendored

File diff suppressed because one or more lines are too long

1
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.ie.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.ie.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui.min.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because one or more lines are too long

2
dist/fineui_without_jquery_polyfill.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/utils.min.js.map vendored

File diff suppressed because one or more lines are too long

39
index.html

@ -3,45 +3,12 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title></title> <title>Demo</title>
<!--核心css文件--> <link rel="stylesheet" href="./dist/demo.css">
<link rel="stylesheet" type="text/css" href="dist/core.css"/>
<!--基础css文件, 包含一些最基本控件的样式-->
<link rel="stylesheet" type="text/css" href="dist/base.css"/>
<!--BI控件样式-->
<link rel="stylesheet" type="text/css" href="dist/widget.css"/>
<!--资源样式, 包括font、icon、background、app-->
<link rel="stylesheet" type="text/css" href="dist/resource.css"/>
<!--当前demo定义的样式-->
<link rel="stylesheet" type="text/css" href="dist/demo.css"/>
<!--IE9及以下兼容-->
<script src="dist/polyfill.js"></script>
<!--核心js-->
<script src="dist/core.js"></script>
<!--BI路由js-->
<script src="dist/router.js"></script>
<!--fix2.0版本框架, 只用ui的话不用引入, 引入的顺序需在core.js之后-->
<script src="dist/fix/fix.js"></script>
<!--基础js, 包括最基本的控件-->
<script src="dist/base.js"></script>
<!--基础js, 存放一些通用组件,如选色组件、富文本组件等-->
<script src="dist/case.js"></script>
<!--BI控件js-->
<script src="dist/widget.js"></script>
<!--fix2.0版本框架与fineui结合的代码, 只用ui的话不用引入, 引入的顺序需在fix和控件库(core/base/case/widget)之后之后-->
<script src="dist/fix/fix.compact.js"></script>
<!--工程配置文件,主要是BI.servletURL(根目录)、BI.resourceURL(资源路径)、BI.i18n(国际化)-->
<script src="dist/config.js"></script>
<script src="dist/demo.js"></script>
</head> </head>
<body> <body>
<div id="wrapper"></div> <div id="wrapper"></div>
</body> </body>
<script src="./dist/demo.js"></script>
</html> </html>

97
lib/postbuild/postbuild.js

@ -1,43 +1,70 @@
const Concat = require("concat-with-sourcemaps");
const { resolve } = require("path"); const { resolve } = require("path");
const fs = require("fs"); const { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } = require("fs");
const rimraf = require("rimraf");
function unionJs(filenames) { const dest = resolve(__dirname, '../../dist');
const filename = filenames[0];
const concat = new Concat(true, filename, "\n"); const $dest = resolve(dest, './2.0');
filenames.forEach(filename => { if (!existsSync($dest)) {
concat.add( mkdirSync($dest);
filename, }
fs.readFileSync(resolve(__dirname, `../../dist/${filename}`)),
fs.readFileSync(resolve(__dirname, `../../dist/${filename}.map`)).toString() const deleteList = [
); "bundle.ie.css",
}); "bundle_without_normalize.js",
"bundle_without_normalize.js.map",
"fineui.ie.css",
"fineui_without_jquery_polyfill.css",
];
const copyList = [{
source: "bundle.min",
exts: ["css", "js", "js.map"],
targets: ["2.0/fineui", "2.0/fineui.min"],
}, {
source: "bundle_without_normalize",
exts: ["css"],
targets: ["2.0/fineui_without_normalize", "2.0/fineui_without_normalize.min"],
}, {
source: "fineui",
exts: ["css", "js", "js.map"],
targets: ["fineui.min"],
}, {
source: "utils",
exts: ["js", "js.map"],
targets: ["utils.min"],
}, {
source: "bundle.ie",
exts: ["js", "js.map"],
targets: ["2.0/fineui.ie", "2.0/fineui.ie.min"],
}];
copyList.forEach(conf => {
conf.exts.forEach(ext => {
const sourcefile = resolve(dest, `./${conf.source}.${ext}`);
if (!existsSync(sourcefile)) {
console.log(`${sourcefile} does not exist!`);
}
// 剔除所有的sourcemap痕迹 conf.targets.forEach(target => {
const concatenatedContent = concat.content.toString().replace(/\/\/# sourceMappingURL=.+/g, ""); copyFileSync(sourcefile, resolve(dest, `./${target}.${ext}`));
const sourceMapForContent = concat.sourceMap; });
fs.writeFileSync(resolve(__dirname, "../../dist", filename), concatenatedContent, {
encoding: "utf8",
}); });
});
fs.writeFileSync(resolve(__dirname, "../../dist", `${filename}.map`), sourceMapForContent, {
encoding: "utf8", deleteList.forEach(filename => {
const sourcefile = resolve(dest, `./${filename}`);
rimraf(sourcefile, () => {
console.log(`${sourcefile} deleted`);
}); });
} });
const demoJs = resolve(dest, './demo.js');
const content = `${readFileSync(demoJs, { encoding: 'utf8' })}
//# sourceMappingURL=./demo.js.map`;
unionJs(["bundle.min.js", "es5.fineui.js"]); writeFileSync(demoJs, content);
unionJs(["bundle.ie.min.js", "ie.fineui.js"]);
unionJs(["fineui.min.js", "es5.fineui.js"]);
unionJs(["fineui.ie.min.js", "ie.fineui.js"]);
unionJs(["2.0/fineui.min.js", "es5.fineui.js"]);
unionJs(["2.0/fineui.ie.min.js", "ie.fineui.js"]);
unionJs(["bundle.js", "es5.fineui.js"]);
unionJs(["2.0/fineui.js", "es5.fineui.js"]);
unionJs(["bundle.ie.js", "ie.fineui.js"]);
unionJs(["2.0/fineui.ie.js", "ie.fineui.js"]);
unionJs(["fineui.js", "es5.fineui.js"]);
unionJs(["fineui.ie.js", "ie.fineui.js"]);

22
package.json

@ -22,7 +22,6 @@
"autoprefixer": "9.6.1", "autoprefixer": "9.6.1",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
"chai": "4.2.0", "chai": "4.2.0",
"concat-with-sourcemaps": "1.1.0",
"core-js": "3.3.2", "core-js": "3.3.2",
"cross-env": "6.0.0", "cross-env": "6.0.0",
"css-loader": "3.0.0", "css-loader": "3.0.0",
@ -31,16 +30,6 @@
"express": "4.15.2", "express": "4.15.2",
"fork-ts-checker-webpack-plugin": "1.4.3", "fork-ts-checker-webpack-plugin": "1.4.3",
"grunt": "1.0.1", "grunt": "1.0.1",
"grunt-contrib-clean": "1.1.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-connect": "1.0.2",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "1.0.1",
"grunt-contrib-jshint": "1.0.0",
"grunt-contrib-less": "1.4.1",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-webpack": "3.1.3",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"husky": "^3.1.0", "husky": "^3.1.0",
"karma": "3.1.4", "karma": "3.1.4",
@ -48,6 +37,7 @@
"karma-chrome-launcher": "2.2.0", "karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2", "karma-coverage": "1.1.2",
"karma-mocha": "1.3.0", "karma-mocha": "1.3.0",
"less": "3.11.2",
"less-loader": "5.0.0", "less-loader": "5.0.0",
"mini-css-extract-plugin": "0.7.0", "mini-css-extract-plugin": "0.7.0",
"mocha": "5.2.0", "mocha": "5.2.0",
@ -57,6 +47,7 @@
"postcss-loader": "3.0.0", "postcss-loader": "3.0.0",
"postcss-simple-vars": "5.0.2", "postcss-simple-vars": "5.0.2",
"puppeteer": "2.1.0", "puppeteer": "2.1.0",
"rimraf": "3.0.2",
"source-map-loader": "0.2.4", "source-map-loader": "0.2.4",
"style-loader": "0.23.1", "style-loader": "0.23.1",
"typescript": "3.5.2", "typescript": "3.5.2",
@ -67,18 +58,13 @@
"webpack-merge": "4.2.1" "webpack-merge": "4.2.1"
}, },
"scripts": { "scripts": {
"grunt": "grunt",
"webpack:dev": "webpack-dev-server -p --progress --host 0.0.0.0 --config=webpack/webpack.dev.js --mode development", "webpack:dev": "webpack-dev-server -p --progress --host 0.0.0.0 --config=webpack/webpack.dev.js --mode development",
"webpack:prod": "webpack -p --progress --config=webpack/webpack.prod.js --mode production", "webpack:prod": "webpack -p --progress --config=webpack/webpack.prod.js --mode production",
"webpack:prod:ie8": "cross-env BROWSER_VERSION=ie8 webpack -p --progress --config=webpack/webpack.prod.js --mode production",
"start": "node server.js", "start": "node server.js",
"build": "npm run webpack:prod && npm run webpack:prod:ie8 && grunt build && tsc", "build": "npm run webpack:prod && tsc",
"postbuild": "node ./lib/postbuild/postbuild.js", "postbuild": "node ./lib/postbuild/postbuild.js",
"compile": "grunt compile",
"fake": "grunt fake-build",
"test": "karma start", "test": "karma start",
"analyze": "grunt analyze", "dev": "npm run webpack:dev",
"dev": "npm-run-all --parallel grunt webpack:dev",
"prepublishOnly": "npm run build && node ./lib/prepublish/prepublish.js" "prepublishOnly": "npm run build && node ./lib/prepublish/prepublish.js"
}, },
"repository": { "repository": {

12
template/index.html

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<div id="wrapper"></div>
</body>
</html>

243
webpack/attachments.js

@ -0,0 +1,243 @@
const grunt = require("grunt");
function uniq(names) {
return [...new Set(names)];
}
function sync(patterns) {
return uniq(grunt.file.expand({ filter: path => !new RegExp(/__test__/g).test(path) }, patterns)).map(name => `./${name}`);
}
const basicAttachmentMap = {
polyfill: sync(["src/core/foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]),
polyfillIE: sync(["src/core/foundation.js", "src/polyfill/**/*.js"]).concat([
"core-js/features/object/define-property",
"core-js/features/object/create",
"core-js/features/object/assign",
"core-js/features/object/get-own-property-symbols",
"core-js/features/object/get-prototype-of",
"core-js/features/array/for-each",
"core-js/features/array/index-of",
"core-js/features/function/bind",
"core-js/features/promise",
"core-js/features/string/replace",
"core-js/es/map",
// "core-js",
]),
core: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
"src/core/foundation.js",
"src/core/lodash.js",
// 'src/core/mvc/**/*.js',
"src/core/base.js",
"src/core/ob.js",
"src/core/widget.js",
// 'src/core/model.js',
// 'src/core/view.js',
"src/core/shortcut.js",
"src/core/utils/**/*.js",
"src/core/behavior/behavior.js",
"src/core/wrapper/layout.js",
"src/core/plugin.js",
"src/core/**/*.js",
"src/data/data.js",
"src/data/**/*.js",
]),
// 最基础的控件
base: sync([
"src/less/base/**/*.less",
"src/third/**/*.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/tree/ztree/treeview.js",
"src/base/tree/ztree/asynctree.js",
"src/base/tree/ztree/parttree.js",
"src/base/tree/ztree/list/listtreeview.js",
"src/base/tree/ztree/list/listasynctree.js",
"src/base/tree/ztree/list/listparttree.js",
"src/base/**/*.js",
]),
// 实现好的一些基础实例
case: sync([
"src/case/combo/popup.bubble.js",
"src/case/**/*.js",
]),
widget: sync([
"src/less/widget/**/*.less",
"src/widget/**/*.js",
"src/component/**/*.js",
]),
router: sync([
"src/router/**/*.js",
]),
'core_without_normalize': sync(
["src/less/core/**/*.less", "src/less/theme/**/*.less", "!src/less/core/normalize.less", "!src/less/core/normalize2.less"],
),
resource: sync(["src/less/resource/**/*.less"]),
font: sync(["public/less/font.less"]),
ts: ['./typescript/bundle.ts'],
ui: sync(['ui/js/**/*.js']),
config: sync(["demo/version.js", "i18n/i18n.cn.js"]),
utils: sync([
"src/core/foundation.js",
"src/core/lodash.js",
"src/core/var.js",
"src/core/func/array.js",
"src/core/func/number.js",
"src/core/func/string.js",
"src/core/func/date.js",
"src/core/func/function.js",
"src/core/base.js",
"src/core/ob.js",
"src/core/alias.js",
"src/core/inject.js",
"src/core/i18n.js",
"src/core/utils/*.js",
"i18n/i18n.cn.js",
"_mobile/date.i18n.cn.js",
"src/data/data.js",
"src/data/**/*.js",
]),
fix: ['./typescript/fix/fix.ts'],
fixIE: ['./typescript/fix/fix.ie.ts'],
};
const bundle = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core,
basicAttachmentMap.fix,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'],
basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts,
);
const bundleIE = [].concat(
basicAttachmentMap.polyfillIE,
basicAttachmentMap.core,
basicAttachmentMap.fixIE,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.ie.js'],
basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts,
);
const bundleWithoutNormalize = [].concat(
basicAttachmentMap.core_without_normalize,
sync([
"src/less/base/**/*.less",
"src/less/widget/**/*.less",
"public/less/app.less",
"public/less/**/*.less",
// ts的less
]),
);
const fineui = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core,
basicAttachmentMap.fix,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
["./dist/fix/fix.compact.js"],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
const fineuiIE = [].concat(
basicAttachmentMap.polyfillIE,
basicAttachmentMap.core,
basicAttachmentMap.fixIE,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
["./dist/fix/fix.compact.ie.js"],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
const fineuiWithoutJqueryAndPolyfillJs = [].concat(
sync([
"src/core/foundation.js",
"src/core/lodash.js",
// 'src/core/mvc/**/*.js',
"src/core/base.js",
"src/core/ob.js",
"src/core/widget.js",
// 'src/core/model.js',
// 'src/core/view.js',
"src/core/shortcut.js",
"src/core/utils/*.js",
"src/core/behavior/behavior.js",
"src/core/wrapper/layout.js",
"src/core/plugin.js",
"src/core/**/*.js",
"!src/core/platform/web/**/*.js",
"src/data/data.js",
"src/data/**/*.js",
"dist/fix/fix.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/**/*.js",
"!src/base/tree/ztree/**/*.js",
"!src/base/single/input/file.js",
"src/case/combo/popup.bubble.js",
"src/case/**/*.js",
"!src/case/colorchooser/**/*.js",
"!src/case/tree/ztree/**/*.js",
]),
basicAttachmentMap.widget,
sync(["dist/fix/fix.compact.js", "ui/js/**/*.js"]),
basicAttachmentMap.ts,
);
const demo = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core,
basicAttachmentMap.router,
basicAttachmentMap.fix,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]),
['./dist/fix/fix.compact.js'],
basicAttachmentMap.config,
basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),
);
module.exports = {
bundle: uniq(bundle),
bundleIE: uniq(bundleIE),
bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui),
fineuiIE: uniq(fineuiIE),
fineuiWithoutJqueryAndPolyfillJs: uniq(fineuiWithoutJqueryAndPolyfillJs),
utils: uniq(basicAttachmentMap.utils),
demo: uniq(demo),
};

33
webpack/webpack.common.js

@ -3,32 +3,15 @@ const autoprefixer = require("autoprefixer");
const dirs = require("./dirs"); const dirs = require("./dirs");
const isBuilt4IE8 = process.env.BROWSER_VERSION === "ie8"; const attachments = require("./attachments");
module.exports = { module.exports = {
entry: { entry: {
polyfill: isBuilt4IE8 demo: attachments.demo,
? [ },
"core-js/features/object/define-property", externals: {
"core-js/features/object/create", lodash: '_',
"core-js/features/object/assign", underscore: '_',
"core-js/features/object/get-own-property-symbols",
"core-js/features/object/get-prototype-of",
"core-js/features/array/for-each",
"core-js/features/array/index-of",
"core-js/features/function/bind",
"core-js/features/promise",
"core-js/features/string/replace",
"core-js/es/map",
// "core-js",
]
: [
"@babel/polyfill",
"es6-promise/auto",
],
fineui: [
"./typescript/bundle.ts",
],
}, },
resolve: { resolve: {
mainFields: ["module", "main"], mainFields: ["module", "main"],
@ -39,11 +22,11 @@ module.exports = {
{ {
test: /\.(js|ts)$/, test: /\.(js|ts)$/,
include: [dirs.NODE_MODULES, dirs.PRIVATE, dirs.TYPESCRIPT], include: [dirs.NODE_MODULES, dirs.PRIVATE, dirs.TYPESCRIPT],
exclude: /node_modules(\/|\\)core-js/, exclude: /(node_modules(\/|\\)core-js|\.\/demo|\.\/src|\.\/public|\.\/i18n|\.\/ui|\.\/_mobile|\.dist).+\.js$/,
use: [{ use: [{
loader: "babel-loader", loader: "babel-loader",
options: { options: {
configFile: isBuilt4IE8 ? dirs.IE8_BABEL_CONFIG : dirs.BABEL_CONFIG, configFile: dirs.IE8_BABEL_CONFIG,
}, },
}, { }, {
loader: "source-map-loader", loader: "source-map-loader",

8
webpack/webpack.dev.js

@ -13,7 +13,7 @@ module.exports = merge(common, {
devtool: "eval-source-map", devtool: "eval-source-map",
output: { output: {
path: dirs.DEST, path: dirs.DEST,
filename: "[name].[contenthash].js", filename: "[name].js",
}, },
devServer: { devServer: {
contentBase: path.join(__dirname, ".."), contentBase: path.join(__dirname, ".."),
@ -23,11 +23,11 @@ module.exports = merge(common, {
plugins: [ plugins: [
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
path: dirs.DEST, path: dirs.DEST,
filename: "fineui.[contenthash].css", filename: "[name].css",
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.resolve(__dirname, "../index.html"), template: path.resolve(__dirname, "../template/index.html"),
chunks: ["polyfill", "fineui"], chunks: ["demo"],
chunksSortMode: "manual", chunksSortMode: "manual",
}), }),
new ForkTsCheckerWebpackPlugin({ new ForkTsCheckerWebpackPlugin({

46
webpack/webpack.prod.js

@ -5,43 +5,53 @@ const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin"); const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const isBuilt4IE8 = process.env.BROWSER_VERSION === "ie8";
const dirs = require("./dirs"); const dirs = require("./dirs");
const common = require("./webpack.common.js"); const common = require("./webpack.common.js");
const attachments = require("./attachments");
module.exports = merge.smart(common, { module.exports = merge.smart(common, {
mode: "production", mode: "production",
entry: {
'bundle.min': attachments.bundle,
'bundle_without_normalize': attachments.bundleWithoutNormalize,
fineui: attachments.fineui,
'fineui_without_jquery_polyfill': attachments.fineuiWithoutJqueryAndPolyfillJs,
utils: attachments.utils,
'bundle.ie': attachments.bundleIE,
'fineui.ie': attachments.fineuiIE,
},
optimization: { optimization: {
minimizer: [ minimizer: [
new UglifyJsPlugin({ new UglifyJsPlugin({
parallel: true, parallel: true,
sourceMap: true, sourceMap: true,
uglifyOptions: { uglifyOptions: {
ie8: true, ie8: true,
output: { output: {
comments: false, comments: false,
},
}, },
} }),
}) new webpack.BannerPlugin({
] banner: `time: ${new Date().toLocaleString()}`,
}, exclude: /\.css$/g,
}),
],
},
devtool: "hidden-source-map", devtool: "hidden-source-map",
output: { output: {
path: dirs.DEST, path: dirs.DEST,
filename: isBuilt4IE8 ? "ie.[name].js" : "es5.[name].js", filename: "[name].js",
}, },
plugins: [ plugins: [
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
path: dirs.DEST, path: dirs.DEST,
filename: "es5.fineui.css", filename: "[name].css",
}),
new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString()}`,
}), }),
new ForkTsCheckerWebpackPlugin({ new ForkTsCheckerWebpackPlugin({
}), }),

790
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save