nuxt-modules / robots

Tame the robots crawling and indexing your Nuxt site.
https://nuxtseo.com/robots
MIT License
424 stars 34 forks source link

Not working on build with Nuxt 3 #108

Closed Saurou closed 1 year ago

Saurou commented 1 year ago

Using Nuxt 3.7.4 with robots.config.ts in root:

export default [
  { UserAgent: '*' },
  { Disallow: () => (process.env.ENVIRONMENT === 'staging' ? '/' : '') }
]

where ENVIRONMENT is declared on the .env file.

It works in dev mode, but does not generate robots.txt on build

I also tested

robots: {
  configPath: './robots.config'
}

in nuxt.config.ts, without success

Saurou commented 1 year ago

Update:

upgrading to 3.0.0-2 solved the issue

I was using 3.0.0-1 which was correctly generating robots.txt with generate, but not on build