Nuxt.js 和 srcDir 选项:呈现 url favicon 404 错误
Nuxt.js and srcDir option: Rendering url favicon 404 error
在 nuxt.config.js
文件中添加 srcDir option 后,我将页面、组件和布局文件夹移动到 src 目录。这是我的配置:
module.exports = {
srcDir: 'src',
head: {
title: 'hello',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'test' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
...
}
现在我收到以下错误消息:
nuxt:render Rendering url /favicon.ico +640ms
{ statusCode: 404,
path: '/favicon.ico',
message: 'This page could not be found' }
删除 .nuxt
文件夹然后重建应用程序没有帮助。我在这里错过了什么?
您的网站图标在 static
目录中:您必须将其与所有来源一起移至 src
。
The documentation 没有提供 "should-be-moved" 目录的详尽列表,但我想其他源目录如 assets
也应该被移动。
在 nuxt.config.js
文件中添加 srcDir option 后,我将页面、组件和布局文件夹移动到 src 目录。这是我的配置:
module.exports = {
srcDir: 'src',
head: {
title: 'hello',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'test' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
...
}
现在我收到以下错误消息:
nuxt:render Rendering url /favicon.ico +640ms
{ statusCode: 404,
path: '/favicon.ico',
message: 'This page could not be found' }
删除 .nuxt
文件夹然后重建应用程序没有帮助。我在这里错过了什么?
您的网站图标在 static
目录中:您必须将其与所有来源一起移至 src
。
The documentation 没有提供 "should-be-moved" 目录的详尽列表,但我想其他源目录如 assets
也应该被移动。