Skip to content

Commit 9e93625

Browse files
committed
feat(pack): 添加打包进度条
1 parent 3a655f2 commit 9e93625

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"loader-utils": "^0.2.15",
3232
"moment": "^2.14.1",
3333
"optimist": "^0.6.1",
34+
"progress-bar-webpack-plugin": "^1.8.0",
3435
"right-pad": "^1.0.0",
3536
"serve-index": "^1.8.0",
3637
"serve-static": "^1.11.1",

src/commands/pack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports.run = (options) => {
1717
var cwd = options.cwd,
1818
min = options.m || options.min || false,
1919
lint = options.l || options.lint || false,
20-
sourcemap = options.s || options.sourcemap || true,
20+
sourcemap = options.s || options.sourcemap,
2121
project = new Project(cwd);
2222

2323
project.readConfig({
@@ -59,7 +59,7 @@ exports.run = (options) => {
5959
}
6060
})
6161

62-
success('complete in ' + statsInfo.time + 'ms\n')
62+
info()
6363

6464
function endWith(string, suffix) {
6565
return string.indexOf(suffix, string.length - suffix.length) !== -1;

src/models/Project.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ let webpack = require('webpack'),
77

88
let Config = require('./Config.js'),
99
Manager = require('../modules/manager.js'),
10-
ExtractTextPlugin = require("extract-text-webpack-plugin");
10+
ExtractTextPlugin = require("extract-text-webpack-plugin"),
11+
ProgressBarPlugin = require('progress-bar-webpack-plugin');
1112

1213
class Project {
1314
constructor(cwd) {
@@ -176,6 +177,8 @@ class Project {
176177
childProcess.execSync('rm -rf ' + config.output.path);
177178
} catch (e) {}
178179

180+
config.plugins.push(new ProgressBarPlugin())
181+
179182
webpack(config, function(err, stats) {
180183
globby.sync('**/*.cache', {
181184
cwd: config.output.path

0 commit comments

Comments
 (0)