Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
hershelh committed Dec 6, 2022
1 parent 164a42e commit 78926cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/assetImportMetaUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions playground/assets/__tests__/assets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
})

Expand Down

0 comments on commit 78926cb

Please sign in to comment.