gatsbyjs/gatsby · error

gatsby-plugin-remove-trailing-slashes: Gatsby now has a trai

Error message

gatsby-plugin-remove-trailing-slashes: Gatsby now has a trailingSlash option. Learn more at https://gatsby.dev/trailing-slash

What it means

Deprecation notice emitted by the plugin's onPreInit: gatsby core now ships a built-in `trailingSlash` config option, so this deprecated wrapper plugin is unnecessary. The plugin still runs (it rewrites page paths by stripping trailing slashes); the warning only points to the replacement.

Source

Thrown at deprecated-packages/gatsby-plugin-remove-trailing-slashes/src/gatsby-node.js:19

// Replacing '/' would result in empty string which is invalid
const replacePath = _path => (_path === `/` ? _path : _path.replace(/\/$/, ``))

exports.onCreatePage = ({ page, actions }) => {
  const { createPage, deletePage } = actions

  return new Promise(resolve => {
    const oldPage = Object.assign({}, page)
    page.path = replacePath(page.path)
    if (page.path !== oldPage.path) {
      deletePage(oldPage)
      createPage(page)
    }
    resolve()
  })
}

exports.onPreInit = ({ reporter }) => {
  reporter.warn(
    `gatsby-plugin-remove-trailing-slashes: Gatsby now has a trailingSlash option. Learn more at https://gatsby.dev/trailing-slash`
  )
}

View on GitHub (pinned to e85d62f177)

Solutions

  1. Remove gatsby-plugin-remove-trailing-slashes
  2. Set `trailingSlash: "never"` in gatsby-config.js instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deprecated-packages/gatsby-plugin-remove-trailing-slashes/src/gatsby-node.js:19 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/1faf6a9e1f69a0b4. Report an issue: GitHub.