From 78926cb8d48ca8123a480f149b6a4722de0cabf5 Mon Sep 17 00:00:00 2001 From: Emma <1285641941@qq.com> Date: Mon, 5 Dec 2022 22:24:22 +0800 Subject: [PATCH] chore: format --- packages/vite/src/node/plugins/assetImportMetaUrl.ts | 4 ++-- playground/assets/__tests__/assets.spec.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/vite/src/node/plugins/assetImportMetaUrl.ts b/packages/vite/src/node/plugins/assetImportMetaUrl.ts index 92e846f04b3c19..4afcccfcdbbe23 100644 --- a/packages/vite/src/node/plugins/assetImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/assetImportMetaUrl.ts @@ -63,7 +63,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin { const resolvedUrl = await aliaResolver( rawUrl.slice(1), undefined, - true + true, ) if (resolvedUrl) { newUrl = normalizePath(path.relative(config.root, resolvedUrl)) @@ -83,7 +83,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin { index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default', as: 'url' }))[${ newUrl ?? rawUrl - }], self.location)` + }], self.location)`, ) continue } diff --git a/playground/assets/__tests__/assets.spec.ts b/playground/assets/__tests__/assets.spec.ts index 1a6134e7ed2442..bc8f3b36ee8a66 100644 --- a/playground/assets/__tests__/assets.spec.ts +++ b/playground/assets/__tests__/assets.spec.ts @@ -317,13 +317,13 @@ test('new URL(`${dynamic}`, import.meta.url)', async () => { test('new URL(`@/${dynamic}`, import.meta.url)', async () => { expect(await page.textContent('.dynamic-import-meta-url-1-alias')).toMatch( - isBuild ? 'data:image/png;base64' : '/foo/nested/icon.png' + isBuild ? 'data:image/png;base64' : '/foo/nested/icon.png', ) expect(await page.textContent('.dynamic-import-meta-url-2-alias')).toMatch( - assetMatch + assetMatch, ) expect(await page.textContent('.dynamic-import-meta-url-js-alias')).toMatch( - isBuild ? 'data:application/javascript;base64' : '/foo/nested/test.js' + isBuild ? 'data:application/javascript;base64' : '/foo/nested/test.js', ) })