优化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
|
||||
})
|
||||
|
||||
// console.log(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)
|
||||
}
|
||||
if (!fs.isfile(file)) {
|
||||
console.clear()
|
||||
console.log(cyan(rpath), red(`not found!!!`))
|
||||
console.log(
|
||||
red(
|
||||
|
@ -164,6 +161,9 @@ export default async function createServer(root = '', conf = {}) {
|
|||
),
|
||||
blue('/index.vue')
|
||||
)
|
||||
res.writeHead(404, 'Not Found')
|
||||
res.end('')
|
||||
return
|
||||
}
|
||||
|
||||
code = compileVue(file, conf.imports, {
|
||||
|
@ -207,7 +207,6 @@ export default async function createServer(root = '', conf = {}) {
|
|||
} else if (fs.isfile(join(PUBLIC_DIR, pathname))) {
|
||||
code = fs.cat(join(PUBLIC_DIR, pathname))
|
||||
} else {
|
||||
console.clear()
|
||||
console.log(cyan(pathname), red(`not found!!!`))
|
||||
console.log(
|
||||
red(
|
||||
|
@ -215,6 +214,9 @@ export default async function createServer(root = '', conf = {}) {
|
|||
),
|
||||
blue('/index.js')
|
||||
)
|
||||
res.writeHead(404, 'Not Found')
|
||||
res.end('')
|
||||
return
|
||||
}
|
||||
code = parseJs(code + '', conf.imports, {
|
||||
IS_MPA,
|
||||
|
@ -237,7 +239,6 @@ export default async function createServer(root = '', conf = {}) {
|
|||
code = null
|
||||
}
|
||||
if (code === null) {
|
||||
console.clear()
|
||||
console.log(cyan(pathname), red(`not found!!!`))
|
||||
res.writeHead(404, 'Not Found')
|
||||
res.end('')
|
||||
|
|
Loading…
Reference in New Issue