Skip to content

Commit 50b40ce

Browse files
committed
fix(pack): 修复打包错误重复输出
1 parent d768885 commit 50b40ce

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

lib/commands/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ exports.run = function (options) {
162162
});
163163

164164
nextConfig.plugins.push(require('../plugins/progressBarPlugin.js'));
165+
nextConfig.plugins.push(require('../plugins/compileInfoPlugin.js'));
165166

166167
return nextConfig;
167168
});

lib/models/Config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var _createClass = function () { function defineProperties(target, props) { for
77
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
88

99
var ExtractTextPlugin = require("extract-text-webpack-plugin");
10-
var webpack = require('webpack');
10+
1111
var Config = function () {
1212
function Config(cwd) {
1313
_classCallCheck(this, Config);
@@ -42,9 +42,7 @@ var Config = function () {
4242
}],
4343
postLoaders: []
4444
},
45-
plugins: [require('../plugins/extTemplatedPathPlugin.js'), require('../plugins/requireModulePlugin.js'), require('../plugins/compileInfoPlugin.js'), new webpack.DefinePlugin({
46-
'process.env.NODE_ENV': JSON.stringify('dev')
47-
})],
45+
plugins: [require('../plugins/extTemplatedPathPlugin.js'), require('../plugins/requireModulePlugin.js')],
4846
resolve: {
4947
root: [],
5048
extensions: ['', '.js', '.css', '.json', '.string', '.tpl'],
@@ -166,4 +164,4 @@ var Config = function () {
166164

167165
;
168166

169-
module.exports = Config;
167+
module.exports = Config;

lib/models/Project.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ var Project = function () {
323323
var config = this.config.getConfig();
324324
UtilFs.deleteFolderRecursive(this.cachePath);
325325

326-
var process = function process() {
326+
var compilerProcess = function compilerProcess() {
327327

328328
if (opt.sourcemap) {
329329
config.devtool = opt.sourcemap;
@@ -374,6 +374,8 @@ var Project = function () {
374374
errorDetails: false
375375
});
376376

377+
process.stdout.write("\x1b[90m" + '-------------------------- YKIT PACKED ASSETS -------------------------- ' + "\x1b[0m \n\n");
378+
377379
if (statsInfo.errors.length > 0) {
378380
statsInfo.errors.map(function (err) {
379381
error(err.red);
@@ -410,14 +412,14 @@ var Project = function () {
410412
}], function (err, results) {
411413
if (!err) {
412414
if (results[0] && results[1]) {
413-
process();
415+
compilerProcess();
414416
}
415417
} else {
416418
error(err.stack);
417419
}
418420
});
419421
} else {
420-
process();
422+
compilerProcess();
421423
}
422424

423425
return this;

src/commands/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ exports.run = (options) => {
161161
})
162162

163163
nextConfig.plugins.push(require('../plugins/progressBarPlugin.js'))
164+
nextConfig.plugins.push(require('../plugins/compileInfoPlugin.js'))
164165

165166
return nextConfig
166167
});

src/models/Config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class Config {
3939
},
4040
plugins: [
4141
require('../plugins/extTemplatedPathPlugin.js'),
42-
require('../plugins/requireModulePlugin.js'),
43-
require('../plugins/compileInfoPlugin.js'),
42+
require('../plugins/requireModulePlugin.js')
4443
],
4544
resolve: {
4645
root: [],

src/models/Project.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class Project {
290290
let config = this.config.getConfig();
291291
UtilFs.deleteFolderRecursive(this.cachePath)
292292

293-
let process = () => {
293+
let compilerProcess = () => {
294294

295295
if (opt.sourcemap) {
296296
config.devtool = opt.sourcemap
@@ -339,6 +339,12 @@ class Project {
339339
errorDetails: false
340340
});
341341

342+
process.stdout.write(
343+
"\x1b[90m"
344+
+ '-------------------------- YKIT PACKED ASSETS -------------------------- '
345+
+ "\x1b[0m \n\n"
346+
)
347+
342348
if (statsInfo.errors.length > 0) {
343349
statsInfo.errors.map((err) => {
344350
error(err.red);
@@ -374,14 +380,14 @@ class Project {
374380
], (err, results) => {
375381
if (!err) {
376382
if (results[0] && results[1]) {
377-
process();
383+
compilerProcess();
378384
}
379385
} else {
380386
error(err.stack);
381387
}
382388
});
383389
} else {
384-
process();
390+
compilerProcess();
385391
}
386392

387393
return this;

0 commit comments

Comments
 (0)