From 0072587f14300c851d962633a0aafb8e5d1299fb Mon Sep 17 00:00:00 2001 From: vagusX Date: Sun, 14 Apr 2024 11:09:47 +0800 Subject: [PATCH] scripts: fix tar esm issue (#48442) * Update build.ts Signed-off-by: vagusX * Update build.ts Signed-off-by: vagusX --------- Signed-off-by: vagusX --- scripts/visual-regression/build.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/visual-regression/build.ts b/scripts/visual-regression/build.ts index 4166c6eab6d8..df6257303192 100644 --- a/scripts/visual-regression/build.ts +++ b/scripts/visual-regression/build.ts @@ -16,7 +16,6 @@ import { remark } from 'remark'; import remarkGfm from 'remark-gfm'; import remarkHtml from 'remark-html'; import sharp from 'sharp'; -import tar from 'tar'; const ROOT_DIR = process.cwd(); const ALI_OSS_BUCKET = 'antd-visual-diff'; @@ -106,6 +105,7 @@ async function getBranchLatestRef(branchName: string) { } async function downloadBaseSnapshots(ref: string, targetDir: string) { + const tar = await import('tar'); // download imageSnapshotsUrl const imageSnapshotsUrl = `${ossDomain}/${ref}/imageSnapshots.tar.gz`; const targzPath = path.resolve(os.tmpdir(), `./${path.basename(targetDir)}.tar.gz`); @@ -350,7 +350,7 @@ async function boot() { htmlTemplate.replace('{{reportContent}}', reportHtmlStr), 'utf-8', ); - + const tar = await import('tar'); await tar.c( { gzip: true,