chore: move vite root dir into template folder (#29081)

This commit is contained in:
Pavel Feldman 2024-01-23 09:40:05 -08:00 committed by GitHub
parent d89ed88679
commit 41c15cb176
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -24,6 +24,6 @@
</head> </head>
<body> <body>
<div id='root'></div> <div id='root'></div>
<script type='module' src='/playwright/index.ts'></script> <script type='module' src='/index.ts'></script>
</body> </body>
</html> </html>

View file

@ -76,8 +76,9 @@ export function createPlugin(
// Compose base config from the playwright config only. // Compose base config from the playwright config only.
const baseConfig: InlineConfig = { const baseConfig: InlineConfig = {
root: configDir, root: templateDir,
configFile: false, configFile: false,
publicDir: path.join(configDir, 'public'),
define: { define: {
__VUE_PROD_DEVTOOLS__: true, __VUE_PROD_DEVTOOLS__: true,
}, },
@ -189,7 +190,6 @@ export function createPlugin(
if (sourcesDirty) { if (sourcesDirty) {
log('build'); log('build');
await build(finalConfig); await build(finalConfig);
await fs.promises.rename(`${finalConfig.build.outDir}/${relativeTemplateDir}/index.html`, `${finalConfig.build.outDir}/index.html`);
buildInfo.deps = Object.fromEntries(depsCollector.entries()); buildInfo.deps = Object.fromEntries(depsCollector.entries());
} }

View file

@ -39,7 +39,7 @@ test('should work with the empty component list', async ({ runInlineTest }, test
expect(result.passed).toBe(1); expect(result.passed).toBe(1);
const output = result.output; const output = result.output;
expect(output).toContain('transforming...'); expect(output).toContain('transforming...');
expect(output.replace(/\\+/g, '/')).toContain('playwright/.cache/playwright/index.html'); expect(output.replace(/\\+/g, '/')).toContain('.cache/index.html');
const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8')); const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8'));
expect(metainfo.version).toEqual(require('playwright-core/package.json').version); expect(metainfo.version).toEqual(require('playwright-core/package.json').version);