Webpack build improvement

This commit is contained in:
Tony Air 2019-10-20 08:19:20 +07:00
parent e0f847f550
commit 58bf6f924a
7 changed files with 172 additions and 13988 deletions

13852
dist/css/main.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"css/main.css","sourceRoot":""}

129
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

133
dist/js/app.js.LICENSE vendored Normal file
View File

@ -0,0 +1,133 @@
/*!
* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
*
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
/*!
* Timepicker Component for Twitter Bootstrap
*
* Copyright 2013 Joris de Wit and bootstrap-timepicker contributors
*
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*!
* Bootstrap alert.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap button.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap carousel.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap collapse.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap modal.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap popover.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap scrollspy.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap tab.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap tooltip.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Bootstrap util.js v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
/*!
* hoverIntent v1.10.1 // 2019.10.05 // jQuery v1.7.0+
* http://briancherne.github.io/jquery-hoverIntent/
*
* You may use hoverIntent under the terms of the MIT license. Basically that
* means you are free to use hoverIntent as long as this header is left intact.
* Copyright 2007-2019 Brian Cherne
*/
/*!
* jquery.inputmask.bundle.js
* https://github.com/RobinHerbots/jquery.inputmask
* Copyright (c) 2010 - 2016 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 3.3.4
*/
/*@cc_on!@*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.0
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
*/
/*! smooth-scroll v14.2.1 | (c) 2018 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */

1
dist/js/app.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"js/app.js","sourceRoot":""}

View File

@ -101,6 +101,7 @@
"script-ext-html-webpack-plugin": "^2.1.4", "script-ext-html-webpack-plugin": "^2.1.4",
"style-loader": "^0.19.0", "style-loader": "^0.19.0",
"svg-url-loader": "^2.3.3", "svg-url-loader": "^2.3.3",
"terser-webpack-plugin": "^2.1.3",
"uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony-v2.8.22", "uglify-js": "git://github.com/mishoo/UglifyJS2.git#harmony-v2.8.22",
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^0.6.2", "url-loader": "^0.6.2",
@ -115,7 +116,8 @@
"block-no-empty": null, "block-no-empty": null,
"color-no-invalid-hex": true, "color-no-invalid-hex": true,
"comment-empty-line-before": [ "comment-empty-line-before": [
"always", { "always",
{
"ignore": [ "ignore": [
"stylelint-commands", "stylelint-commands",
"after-comment" "after-comment"
@ -124,7 +126,8 @@
], ],
"declaration-colon-space-after": "always", "declaration-colon-space-after": "always",
"indentation": [ "indentation": [
4, { 4,
{
"except": [ "except": [
"value" "value"
] ]
@ -132,7 +135,8 @@
], ],
"max-empty-lines": 2, "max-empty-lines": 2,
"rule-empty-line-before": [ "rule-empty-line-before": [
"always", { "always",
{
"except": [ "except": [
"first-nested" "first-nested"
], ],

View File

@ -4,7 +4,9 @@ const path = require('path');
const autoprefixer = require('autoprefixer'); const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = { module.exports = {
entry: './src/js/app.js', entry: './src/js/app.js',
@ -25,12 +27,18 @@ module.exports = {
noEmitOnErrors: true, // NoEmitOnErrorsPlugin noEmitOnErrors: true, // NoEmitOnErrorsPlugin
concatenateModules: true, //ModuleConcatenationPlugin concatenateModules: true, //ModuleConcatenationPlugin
minimizer: [ minimizer: [
new UglifyJSPlugin({ new TerserPlugin({
uglifyOptions: { parallel: true,
sourceMap: false, sourceMap: false,
comments: false terserOptions: {
} parse: {
}) ecma: 8,
},
output: {
ecma: 5,
},
},
}),
] ]
}, },
module: { module: {
@ -156,6 +164,18 @@ module.exports = {
filename: 'css/[name].css', filename: 'css/[name].css',
allChunks: true allChunks: true
}), }),
new OptimizeCssAssetsPlugin({
//assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorPluginOptions: {
preset: ['default', {
discardComments: {
removeAll: true
}
}],
},
canPrint: true
}),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './src/index.html' template: './src/index.html'
}), }),