mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00: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 registerSource = await fs.promises.readFile(registerSourceFile, 'utf-8');
|
||||||
const registerSourceHash = calculateSha1(registerSource);
|
const registerSourceHash = calculateSha1(registerSource);
|
||||||
|
|
||||||
const { version: viteVersion } = require('vite/package.json');
|
const { version: viteVersion } = await import('vite');
|
||||||
try {
|
try {
|
||||||
buildInfo = JSON.parse(await fs.promises.readFile(buildInfoFile, 'utf-8')) as BuildInfo;
|
buildInfo = JSON.parse(await fs.promises.readFile(buildInfoFile, 'utf-8')) as BuildInfo;
|
||||||
assert(buildInfo.version === playwrightVersion);
|
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.
|
// Build config unconditionally, either build or build & preview will use it.
|
||||||
viteConfig.plugins ??= [];
|
viteConfig.plugins ??= [];
|
||||||
if (frameworkPluginFactory && !viteConfig.plugins.length)
|
if (frameworkPluginFactory && !viteConfig.plugins.length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user