Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser: @vite/client cannot load when a custom base is set #6509

Closed
6 tasks done
nstepien opened this issue Sep 14, 2024 · 0 comments · Fixed by #6510
Closed
6 tasks done

browser: @vite/client cannot load when a custom base is set #6509

nstepien opened this issue Sep 14, 2024 · 0 comments · Fixed by #6510

Comments

@nstepien
Copy link
Contributor

Describe the bug

When a custom base is set in the vite config, browser tests fail to load /custom-base/@vite/client.
This error doesn't show up in the cli, but it does show up in the browser's console.
It doesn't seem to affect tests though, afaict.

image

Setting '/' for tests only fixes the issue.

const isTest = process.env.NODE_ENV === 'test';

export default defineConfig({
  base: isTest ? '/' : '/custom-base/',

Reproduction

export default defineConfig({
  base: '/custom-base/',
  // ...
  test: {
    browser: {
      enabled: true,
      name: 'chromium',
      provider: 'playwright',
      headless: false
    }
  }
});

Not minimal, but you can also reproduce with this repo:
https://github.com/adazzle/react-data-grid/blob/main/vite.config.ts#L11

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (64) x64 AMD Ryzen Threadripper 3970X 32-Core Processor
    Memory: 16.97 GB / 31.88 GB
  Binaries:
    Node: 22.8.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @vitejs/plugin-react: ^4.3.1 => 4.3.1
    @vitest/browser: ^2.1.1 => 2.1.1
    @vitest/coverage-v8: ^2.1.1 => 2.1.1
    @vitest/eslint-plugin: ^1.1.4 => 1.1.4
    vite: ^5.4.5 => 5.4.5
    vitest: ^2.1.1 => 2.1.1

Used Package Manager

npm

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant