优化404提示
parent
5b33c56e5f
commit
03ace216e4
11
lib/dev.js
11
lib/dev.js
|
@ -138,8 +138,6 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
DEPLOY_PATH
|
DEPLOY_PATH
|
||||||
})
|
})
|
||||||
|
|
||||||
// console.log(entry);
|
|
||||||
|
|
||||||
code = parseHtml(html, { page, imports: conf.imports, entry })
|
code = parseHtml(html, { page, imports: conf.imports, entry })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +154,6 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
file = join(SOURCE_DIR, rpath)
|
file = join(SOURCE_DIR, rpath)
|
||||||
}
|
}
|
||||||
if (!fs.isfile(file)) {
|
if (!fs.isfile(file)) {
|
||||||
console.clear()
|
|
||||||
console.log(cyan(rpath), red(`not found!!!`))
|
console.log(cyan(rpath), red(`not found!!!`))
|
||||||
console.log(
|
console.log(
|
||||||
red(
|
red(
|
||||||
|
@ -164,6 +161,9 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
),
|
),
|
||||||
blue('/index.vue')
|
blue('/index.vue')
|
||||||
)
|
)
|
||||||
|
res.writeHead(404, 'Not Found')
|
||||||
|
res.end('')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
code = compileVue(file, conf.imports, {
|
code = compileVue(file, conf.imports, {
|
||||||
|
@ -207,7 +207,6 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
} else if (fs.isfile(join(PUBLIC_DIR, pathname))) {
|
} else if (fs.isfile(join(PUBLIC_DIR, pathname))) {
|
||||||
code = fs.cat(join(PUBLIC_DIR, pathname))
|
code = fs.cat(join(PUBLIC_DIR, pathname))
|
||||||
} else {
|
} else {
|
||||||
console.clear()
|
|
||||||
console.log(cyan(pathname), red(`not found!!!`))
|
console.log(cyan(pathname), red(`not found!!!`))
|
||||||
console.log(
|
console.log(
|
||||||
red(
|
red(
|
||||||
|
@ -215,6 +214,9 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
),
|
),
|
||||||
blue('/index.js')
|
blue('/index.js')
|
||||||
)
|
)
|
||||||
|
res.writeHead(404, 'Not Found')
|
||||||
|
res.end('')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
code = parseJs(code + '', conf.imports, {
|
code = parseJs(code + '', conf.imports, {
|
||||||
IS_MPA,
|
IS_MPA,
|
||||||
|
@ -237,7 +239,6 @@ export default async function createServer(root = '', conf = {}) {
|
||||||
code = null
|
code = null
|
||||||
}
|
}
|
||||||
if (code === null) {
|
if (code === null) {
|
||||||
console.clear()
|
|
||||||
console.log(cyan(pathname), red(`not found!!!`))
|
console.log(cyan(pathname), red(`not found!!!`))
|
||||||
res.writeHead(404, 'Not Found')
|
res.writeHead(404, 'Not Found')
|
||||||
res.end('')
|
res.end('')
|
||||||
|
|
Loading…
Reference in New Issue