Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Mar 7, 2022
1 parent e6a0f3b commit 8edbe81
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/vite/src/node/importGlob.ts
Expand Up @@ -133,18 +133,19 @@ export async function transformImportGlob(
;[importee] = await normalizeUrl(file, pos)
}
imports.push(importee)
if (
options?.as === 'raw' ||
// TODO remove assert syntax for the Vite 3.0 release.
options?.assert?.type === 'raw'
) {
logger.warn(
colors.yellow(
colors.bold(
"(!) Use `import.meta.globEager('/dir/*.js', { as: 'raw' })` instead of `import.meta.globEager('/dir/*.js', { assert: { type: 'raw' } })` (it will be deprecated in Vite 3.0)."
// TODO remove assert syntax for the Vite 3.0 release.
const isRawAssert = options?.assert?.type === 'raw'
const isRawType = options?.as === 'raw'
if (isRawType || isRawAssert) {
if (isRawAssert) {
logger.warn(
colors.yellow(
colors.bold(
"(!) Use `import.meta.globEager('/dir/*.js', { as: 'raw' })` instead of `import.meta.globEager('/dir/*.js', { assert: { type: 'raw' } })` (it will be deprecated in Vite 3.0)."
)
)
)
)
}
entries += ` ${JSON.stringify(file)}: ${JSON.stringify(
await fsp.readFile(path.join(base, file), 'utf-8')
)},`
Expand Down

0 comments on commit 8edbe81

Please sign in to comment.