fixed windows path

pull/1/head
yutent 2022-10-21 14:22:27 +08:00
parent 1d168f75ec
commit f0cb82e2c0
2 changed files with 5 additions and 3 deletions

View File

@ -13,15 +13,17 @@ import createServer from './lib/dev.js'
import compile from './lib/prod.js' import compile from './lib/prod.js'
const WORK_SPACE = process.cwd() const WORK_SPACE = process.cwd()
const IS_WINDOWS = process.platform === 'win32'
const CONFIG_FILE = join(WORK_SPACE, 'vue.live.js') const CONFIG_FILE = join(WORK_SPACE, 'vue.live.js')
const SOURCE_DIR = join(WORK_SPACE, 'src') const SOURCE_DIR = join(WORK_SPACE, 'src')
const PROTOCOL = IS_WINDOWS ? 'file://' : ''
let args = process.argv.slice(2) let args = process.argv.slice(2)
switch (args[0]) { switch (args[0]) {
case 'dev': case 'dev':
import(CONFIG_FILE) import(PROTOCOL + CONFIG_FILE)
.then(function (conf) { .then(function (conf) {
createServer(SOURCE_DIR, conf.default) createServer(SOURCE_DIR, conf.default)
}) })
@ -31,7 +33,7 @@ switch (args[0]) {
break break
case 'build': case 'build':
import(CONFIG_FILE) import(PROTOCOL + CONFIG_FILE)
.then(function (conf) { .then(function (conf) {
let dist = conf.buildDir || 'dist' let dist = conf.buildDir || 'dist'
if (fs.isdir(dist)) { if (fs.isdir(dist)) {

View File

@ -1,7 +1,7 @@
{ {
"name": "@bytedo/vue-live", "name": "@bytedo/vue-live",
"type": "module", "type": "module",
"version": "0.0.10", "version": "0.0.11",
"bin": { "bin": {
"vue-live": "index.js" "vue-live": "index.js"
}, },