Skip to content

Commit

Permalink
chore: something code suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed Feb 20, 2022
1 parent bff7271 commit 51b28ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/playground/css/main.js
Expand Up @@ -69,9 +69,12 @@ if (import.meta.env.DEV) {
import inlined from './inlined.css?inline'
text('.inlined-code', inlined)

// glob
const glob = import.meta.glob('./glob-import/*.css')
Promise.all(Object.keys(glob).map((key) => glob[key]())).then((res) => {
text('.imported-css-glob', JSON.stringify(res, null, 2))
})

// globEager
const globEager = import.meta.globEager('./glob-import/*.css')
text('.imported-css-globEager', JSON.stringify(globEager, null, 2))
2 changes: 1 addition & 1 deletion packages/vite/src/node/importGlob.ts
@@ -1,4 +1,3 @@
import { isCSSRequest } from './plugins/css'
import path from 'path'
import { promises as fsp } from 'fs'
import glob from 'fast-glob'
Expand All @@ -8,6 +7,7 @@ import {
preloadMethod,
preloadMarker
} from './plugins/importAnalysisBuild'
import { isCSSRequest } from './plugins/css'
import { cleanUrl } from './utils'
import type { RollupError } from 'rollup'

Expand Down

0 comments on commit 51b28ef

Please sign in to comment.