8000 tweak checkEntry · gemmer01/vue-cli@0c36158 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c36158

Browse files
committed
tweak checkEntry
only check entry when there's no custom `run` process
1 parent 6cd53e3 commit 0c36158

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

bin/vue-build

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var options = merge({
7979
})
8080

8181
function help () {
82-
if (!options.entry) {
82+
if (!options.run && !options.entry) {
8383
return program.help()
8484
}
8585
}
@@ -300,16 +300,13 @@ if (!options.disableWebpackConfig) {
300300
}
301301
}
302302

303-
checkEntryExists(options.entry)
303+
// only check entry when there's no custom `run` process
304+
if (!options.run && !fs.existsSync(options.entry)) {
305+
logger.fatal(`${chalk.yellow(options.entry)} does not exist, did you forget to create one?`)
306+
}
304307

305308
run(webpackConfig, options)
306309

307-
function checkEntryExists (entry) {
308-
if (!fs.existsSync(entry)) {
309-
logger.fatal(`${chalk.yellow(entry)} does not exist, did you forget to create one?`)
310-
}
311-
}
312-
313310
function merge (obj) {
314311
var i = 1
315312
var target

lib/run.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ var logger = require('./logger')
66
var createServer = require('../lib/server')
77

88
module.exports = function (webpackConfig, options) {
9+
if (typeof options.run === 'function') {
10+
return options.run(webpackConfig, options)
11+
}
12+
913
try {
1014
var compiler = webpack(webpackConfig)
1115
} catch (err) {
@@ -16,9 +20,7 @@ module.exports = function (webpackConfig, options) {
1620
}
1721
}
1822

19-
if (typeof options.run === 'function') {
20-
options.run(webpackConfig, options)
21-
} else if (options.watch) {
23+
if (options.watch) {
2224
console.log('> Running in watch mode')
2325
rm(path.join(options.dist, '*'))
2426
compiler.watch({}, (err, stats) => handleBuild(err, stats, true))

0 commit comments

Comments
 (0)
0