Skip to content

vite:ssr-require-hook helper leaking into production with VitePress #6305

@antfu

Description

@antfu

Describe the bug

Related to vueuse/vueuse#1106

s.prepend(
`;(${dedupeRequire.toString()})(${JSON.stringify(
config.resolve.dedupe
)});\n`
)

Introduced in #3951

Workaround: add this inline plugin to remove 'vite:ssr-require-hook'

    {
      configResolved(config) {
        const index = config.plugins.findIndex(i => i.name === 'vite:ssr-require-hook')
        if (index > -1)
          config.plugins.splice(index, 1)
      },
    }

Reproduction

https://stackblitz.com/edit/github-2f3nkj?file=index.md

System Info

System:
    OS: macOS 12.0.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 12.74 GB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Firefox: 92.0
    Safari: 15.1
  npmPackages:
    vite: ^2.7.9 => 2.7.9

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions