Commit 0a0971da1d12164647325aaa30706ccf96199b87
Committed by
Sergio Crisostomo

1 parent
a65aef1a
use gzip
Showing
4 changed files
with
38 additions
and
10 deletions
Show diff stats
build/webpack.base.config.js
... | ... | @@ -2,8 +2,9 @@ |
2 | 2 | * 公共配置 |
3 | 3 | */ |
4 | 4 | var path = require('path'); |
5 | +var webpack = require('webpack'); | |
5 | 6 | function resolve (dir) { |
6 | - return path.join(__dirname, '..', dir) | |
7 | + return path.join(__dirname, '..', dir); | |
7 | 8 | } |
8 | 9 | |
9 | 10 | module.exports = { |
... | ... | @@ -63,5 +64,8 @@ module.exports = { |
63 | 64 | 'vue': 'vue/dist/vue.esm.js', |
64 | 65 | '@': resolve('src') |
65 | 66 | } |
66 | - } | |
67 | + }, | |
68 | + plugins: [ | |
69 | + new webpack.optimize.ModuleConcatenationPlugin() | |
70 | + ] | |
67 | 71 | }; | ... | ... |
build/webpack.dist.prod.config.js
... | ... | @@ -2,6 +2,7 @@ var path = require('path'); |
2 | 2 | var webpack = require('webpack'); |
3 | 3 | var merge = require('webpack-merge'); |
4 | 4 | var webpackBaseConfig = require('./webpack.base.config.js'); |
5 | +var CompressionPlugin = require('compression-webpack-plugin'); | |
5 | 6 | |
6 | 7 | process.env.NODE_ENV = 'production'; |
7 | 8 | |
... | ... | @@ -34,6 +35,13 @@ module.exports = merge(webpackBaseConfig, { |
34 | 35 | compress: { |
35 | 36 | warnings: false |
36 | 37 | } |
38 | + }), | |
39 | + new CompressionPlugin({ | |
40 | + asset: '[path].gz[query]', | |
41 | + algorithm: 'gzip', | |
42 | + test: /\.(js|css)$/, | |
43 | + threshold: 10240, | |
44 | + minRatio: 0.8 | |
37 | 45 | }) |
38 | 46 | ] |
39 | 47 | }); | ... | ... |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "iview", |
3 | - "version": "2.3.2", | |
3 | + "version": "2.4.0", | |
4 | 4 | "lockfileVersion": 1, |
5 | 5 | "requires": true, |
6 | 6 | "dependencies": { |
... | ... | @@ -1887,6 +1887,25 @@ |
1887 | 1887 | } |
1888 | 1888 | } |
1889 | 1889 | }, |
1890 | + "compression-webpack-plugin": { | |
1891 | + "version": "1.0.0", | |
1892 | + "resolved": "https://registry.npmjs.org/compression-webpack-plugin/-/compression-webpack-plugin-1.0.0.tgz", | |
1893 | + "integrity": "sha512-OPp+tvvMCd8FrJHDLG4v5EpP4Fe5w5uBNXOmc3K7SdBaK1FH+TGwtafG9GLgTI6c2WHIgDFt98T8qXwaXuyRnw==", | |
1894 | + "requires": { | |
1895 | + "async": "2.4.1", | |
1896 | + "webpack-sources": "1.0.1" | |
1897 | + }, | |
1898 | + "dependencies": { | |
1899 | + "async": { | |
1900 | + "version": "2.4.1", | |
1901 | + "resolved": "https://registry.npmjs.org/async/-/async-2.4.1.tgz", | |
1902 | + "integrity": "sha1-YqVrJ5yYoR0JhwlqAcw+6463u9c=", | |
1903 | + "requires": { | |
1904 | + "lodash": "4.17.4" | |
1905 | + } | |
1906 | + } | |
1907 | + } | |
1908 | + }, | |
1890 | 1909 | "concat-map": { |
1891 | 1910 | "version": "0.0.1", |
1892 | 1911 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
... | ... | @@ -12302,8 +12321,7 @@ |
12302 | 12321 | "lodash": { |
12303 | 12322 | "version": "4.17.4", |
12304 | 12323 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", |
12305 | - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", | |
12306 | - "dev": true | |
12324 | + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" | |
12307 | 12325 | }, |
12308 | 12326 | "lodash._baseassign": { |
12309 | 12327 | "version": "3.2.0", |
... | ... | @@ -14438,14 +14456,12 @@ |
14438 | 14456 | "source-list-map": { |
14439 | 14457 | "version": "2.0.0", |
14440 | 14458 | "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", |
14441 | - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", | |
14442 | - "dev": true | |
14459 | + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==" | |
14443 | 14460 | }, |
14444 | 14461 | "source-map": { |
14445 | 14462 | "version": "0.5.6", |
14446 | 14463 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", |
14447 | - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", | |
14448 | - "dev": true | |
14464 | + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" | |
14449 | 14465 | }, |
14450 | 14466 | "source-map-support": { |
14451 | 14467 | "version": "0.4.18", |
... | ... | @@ -16272,7 +16288,6 @@ |
16272 | 16288 | "version": "1.0.1", |
16273 | 16289 | "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", |
16274 | 16290 | "integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==", |
16275 | - "dev": true, | |
16276 | 16291 | "requires": { |
16277 | 16292 | "source-list-map": "2.0.0", |
16278 | 16293 | "source-map": "0.5.6" | ... | ... |