Skip to content

Commit

Permalink
review: use chunk.name to assign cssAssetName directly
Browse files Browse the repository at this point in the history
  • Loading branch information
aleen42 committed Jun 7, 2023
1 parent ad70c53 commit fec0bee
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -569,16 +569,14 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
pureCssChunks.add(chunk)
}
if (opts.format === 'es' || opts.format === 'cjs') {
const cssAssetName = chunk.facadeModuleId
? normalizePath(path.relative(config.root, chunk.facadeModuleId))
: chunk.name

const isEntry = chunk.isEntry && isPureCssChunk
const cssAssetName =
!isEntry && chunk.facadeModuleId
? normalizePath(path.relative(config.root, chunk.facadeModuleId))
: chunk.name

const lang = path.extname(cssAssetName).slice(1)
const cssFileName = ensureFileExt(
isEntry ? chunk.name : cssAssetName,
'.css',
)
const cssFileName = ensureFileExt(cssAssetName, '.css')

chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName)

Expand Down

0 comments on commit fec0bee

Please sign in to comment.