mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
chore: prefer import over require (#24568)
This commit is contained in:
parent
8fde110c61
commit
6ebee33857
@ -75,7 +75,7 @@ export function createPlugin(
|
||||
const registerSource = await fs.promises.readFile(registerSourceFile, 'utf-8');
|
||||
const registerSourceHash = calculateSha1(registerSource);
|
||||
|
||||
const { version: viteVersion } = require('vite/package.json');
|
||||
const { version: viteVersion } = await import('vite');
|
||||
try {
|
||||
buildInfo = JSON.parse(await fs.promises.readFile(buildInfoFile, 'utf-8')) as BuildInfo;
|
||||
assert(buildInfo.version === playwrightVersion);
|
||||
@ -123,7 +123,7 @@ export function createPlugin(
|
||||
}
|
||||
};
|
||||
}
|
||||
const { build, preview } = require('vite');
|
||||
const { build, preview } = await import('vite');
|
||||
// Build config unconditionally, either build or build & preview will use it.
|
||||
viteConfig.plugins ??= [];
|
||||
if (frameworkPluginFactory && !viteConfig.plugins.length)
|
||||
|
Loading…
Reference in New Issue
Block a user