diff --git a/packages/playwright-test/src/plugins/vitePlugin.ts b/packages/playwright-test/src/plugins/vitePlugin.ts
index 019f97618d..ce8a607ea0 100644
--- a/packages/playwright-test/src/plugins/vitePlugin.ts
+++ b/packages/playwright-test/src/plugins/vitePlugin.ts
@@ -27,7 +27,7 @@ import { assert, calculateSha1 } from 'playwright-core/lib/utils';
import type { AddressInfo } from 'net';
let previewServer: PreviewServer;
-const VERSION = 5;
+const VERSION = 6;
type CtConfig = {
ctPort?: number;
@@ -88,7 +88,6 @@ export function createPlugin(
const sourcesDirty = !buildExists || hasNewComponents || await checkSources(buildInfo);
viteConfig.root = rootDir;
- viteConfig.publicDir = false;
viteConfig.preview = { port };
viteConfig.build = {
outDir
diff --git a/tests/playwright-test/playwright.ct-react.spec.ts b/tests/playwright-test/playwright.ct-react.spec.ts
index 2fd9496aa7..a507b05895 100644
--- a/tests/playwright-test/playwright.ct-react.spec.ts
+++ b/tests/playwright-test/playwright.ct-react.spec.ts
@@ -26,7 +26,6 @@ test('should work with TSX', async ({ runInlineTest }) => {
//@no-header
export const Button = () => ;
`,
-
'src/button.test.tsx': `
//@no-header
import { test, expect } from '@playwright/experimental-ct-react';
@@ -321,3 +320,39 @@ test('should respect default property values', async ({ runInlineTest }) => {
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
});
+
+test('should bundle public folder', async ({ runInlineTest }) => {
+ const result = await runInlineTest({
+ 'playwright/index.html': ``,
+ 'playwright/index.ts': `
+ //@no-header
+ `,
+ 'public/logo.svg': `
+ //@no-header
+ `,
+ 'src/image.tsx': `
+ //@no-header
+ export const Image = () =>
;
+ `,
+ 'src/image.test.tsx': `
+ //@no-header
+ import { test, expect } from '@playwright/experimental-ct-react';
+ import { Image } from './image';
+
+ test('pass', async ({ mount, page }) => {
+ const urls = [];
+ const [response] = await Promise.all([
+ page.waitForResponse('**/*.svg'),
+ mount()
+ ]);
+ const data = await response.body();
+ await expect(data.toString()).toContain('');
+ });
+ `,
+ }, { workers: 1 });
+
+ expect(result.exitCode).toBe(0);
+ expect(result.passed).toBe(1);
+});