Hey there everyone, I'm currently working with Nuxt3 and encountering an error when trying to access the robot.txt file.
Here's the Robot.txt module that I've integrated.
Within my nuxt.config.ts file:
export default defineNuxtConfig({
imports: {
autoImport: true
},
modules: [
'@unocss/nuxt',
'@nuxtjs/robots',
],
robots: {
UserAgent: '*',
Disallow: ''
}
})
Following that, I executed the generate and preview scripts from my package.json file.
Here's a snippet from my package.json file:
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@iconify/json": "^2.1.112",
"@unocss/nuxt": "^0.45.22",
"nuxt": "3.0.0-rc.11"
},
"dependencies": {
"@nuxtjs/robots": "^2.5.0"
}
}
Upon running the preview command/script, the terminal displays INFO: Accepting connections at http://localhost:3000.
However, clicking on the provided address opens the app in the browser, whereas navigating to http://localhost:3000/robot.txt results in a redirect to a 404 page.