Skip to content

Commit

Permalink
Revert "fix(lib): remove pure CSS dynamic import (vitejs#17601)"
Browse files Browse the repository at this point in the history
This reverts commit 055f1c1.
  • Loading branch information
krish9797 committed Sep 24, 2024
1 parent 41caf7a commit a10fc79
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
4 changes: 1 addition & 3 deletions packages/vite/src/node/plugins/importAnalysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
return
}

// If preload is not enabled, we parse through each imports and remove any imports to pure CSS chunks
// as they are removed from the bundle
if (!insertPreload) {
if (ssr || isWorker) {
const removedPureCssFiles = removedPureCssFilesCache.get(config)
if (removedPureCssFiles && removedPureCssFiles.size > 0) {
for (const file in bundle) {
Expand Down
8 changes: 0 additions & 8 deletions playground/lib/__tests__/lib.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ describe.runIf(isBuild)('build', () => {
expect(code).toMatch(/await import\("\.\/message-[-\w]{8}.js"\)/)
})

test('Library mode does not have any reference to pure CSS chunks', async () => {
const code = readFile('dist/lib/dynamic-import-message.es.mjs')

// Does not import pure CSS chunks and replaced by `Promise.resolve({})` instead
expect(code).not.toMatch(/await import\("\.\/dynamic-[-\w]{8}.js"\)/)
expect(code).toMatch(/await Promise.resolve\(\{.*\}\)/)
})

test('@import hoist', async () => {
serverLogs.forEach((log) => {
// no warning from esbuild css minifier
Expand Down

0 comments on commit a10fc79

Please sign in to comment.