From e791692753cea1df5729029e18e329eef53305c1 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 3 Oct 2023 17:54:55 +0200 Subject: [PATCH 1/4] refactor(css): make `removePureCssChunks` a function so it can be unit tested Also refactor replacer code into `getEmptyChunkReplacer` function. Signed-off-by: Ferdinand Thiessen --- .../plugins/__snapshots__/css.spec.ts.snap | 31 ++++ .../src/node/__tests__/plugins/css.spec.ts | 142 ++++++++++++++++++ packages/vite/src/node/plugins/css.ts | 115 +++++++++----- 3 files changed, 250 insertions(+), 38 deletions(-) create mode 100644 packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap diff --git a/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap b/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap new file mode 100644 index 00000000000000..1532ca7ddf1e85 --- /dev/null +++ b/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap @@ -0,0 +1,31 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`getEmptyChunkReplacer > replaces import call 1`] = ` +"import \\"some-module\\"; +/* empty css */import \\"other-module\\";" +`; + +exports[`getEmptyChunkReplacer > replaces require call 1`] = ` +"require(\\"some-module\\"); +/* empty css */require(\\"other-module\\");" +`; + +exports[`getEmptyChunkReplacer > replaces require call in minified code without new lines 1`] = `"require(\\"some-module\\");/* empty css */require(\\"other-module\\");"`; + +exports[`removePureCssChunks > import of removed chunk is dropped 1`] = ` +"import \\"some-module\\"; +/* empty css */import \\"other-module\\"; +" +`; + +exports[`removePureCssChunks > imported assets of css chunk are transfered 1`] = ` +"import \\"some-module\\"; +/* empty css */import \\"other-module\\"; +" +`; + +exports[`removePureCssChunks > require of removed chunk is dropped 1`] = ` +"require(\\"some-module\\"); +/* empty css */require(\\"other-module\\"); +" +`; diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index cccdda396f8df6..d641a5b1719b2c 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -1,13 +1,16 @@ import fs from 'node:fs' import path from 'node:path' import { describe, expect, test, vi } from 'vitest' +import type { OutputBundle, OutputChunk } from 'rollup' import { resolveConfig } from '../../config' import type { InlineConfig } from '../../config' import { convertTargets, cssPlugin, cssUrlRE, + getEmptyChunkReplacer, hoistAtRules, + removePureCssChunks, } from '../../plugins/css' describe('search css url function', () => { @@ -258,3 +261,142 @@ describe('convertTargets', () => { }) }) }) + +describe('removePureCssChunks', () => { + test('import of removed chunk is dropped', () => { + const bundle: OutputBundle = { + 'main.js': { + code: 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";\n', + imports: ['pure_css_chunk.js', 'some-module', 'other-module'], + type: 'chunk', + viteMetadata: { + importedAssets: new Set(), + importedCss: new Set(), + }, + } as any as OutputChunk, + 'pure_css_chunk.js': { + type: 'chunk', + code: '', + imports: [], + viteMetadata: { + importedAssets: new Set(), + importedCss: new Set(), + }, + } as any as OutputChunk, + } + + removePureCssChunks(bundle, ['pure_css_chunk.js'], 'es') + + const chunk = bundle['main.js'] as OutputChunk + expect(chunk.code).toMatchSnapshot() + // import is removed + expect(chunk.imports).toEqual(['some-module', 'other-module']) + }) + + test('require of removed chunk is dropped', () => { + const bundle: OutputBundle = { + 'main.js': { + code: 'require("some-module");\nrequire("pure_css_chunk.js");\nrequire("other-module");\n', + imports: ['pure_css_chunk.js', 'some-module', 'other-module'], + type: 'chunk', + viteMetadata: { + importedAssets: new Set(), + importedCss: new Set(), + }, + } as any as OutputChunk, + 'pure_css_chunk.js': { + type: 'chunk', + code: '', + imports: [], + viteMetadata: { + importedAssets: new Set(), + importedCss: new Set(), + }, + } as any as OutputChunk, + } + + removePureCssChunks(bundle, ['pure_css_chunk.js'], 'cjs') + + const chunk = bundle['main.js'] as OutputChunk + expect(chunk.code).toMatchSnapshot() + // import is removed + expect(chunk.imports).toEqual(['some-module', 'other-module']) + }) + + test('imported assets of css chunk are transfered', () => { + const bundle: OutputBundle = { + 'main.js': { + code: 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";\n', + imports: ['pure_css_chunk.js', 'some-module', 'other-module'], + type: 'chunk', + viteMetadata: { + importedAssets: new Set(), + importedCss: new Set(), + }, + } as any as OutputChunk, + 'pure_css_chunk.js': { + type: 'chunk', + code: '', + imports: [], + viteMetadata: { + importedAssets: new Set(['some-asset.svg']), + importedCss: new Set(['some-style.css']), + }, + } as any as OutputChunk, + } + + removePureCssChunks(bundle, ['pure_css_chunk.js'], 'es') + + const chunk = bundle['main.js'] as OutputChunk + expect(chunk.code).toMatchSnapshot() + // import is removed + expect(chunk.imports).toEqual(['some-module', 'other-module']) + // metadata is transfered + expect(chunk.viteMetadata?.importedAssets.has('some-asset.svg')).toBe(true) + expect(chunk.viteMetadata?.importedCss.has('some-style.css')).toBe(true) + }) +}) + +describe('getEmptyChunkReplacer', () => { + test('replaces import call', () => { + const code = + 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";' + + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'es') + expect(replacer(code)).toMatchSnapshot() + }) + + test('replaces require call', () => { + const code = + 'require("some-module");\nrequire("pure_css_chunk.js");\nrequire("other-module");' + + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') + expect(replacer(code)).toMatchSnapshot() + }) + + test('replaces require call in minified code without new lines', () => { + const code = + 'require("some-module");require("pure_css_chunk.js");require("other-module");' + + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') + expect(replacer(code)).toMatchSnapshot() + }) + + /* Currently broken as the code still contains the css chunk + test('replaces require call in minified code that uses comma operator', () => { + const code = 'require("some-module"),require("pure_css_chunk.js"),require("other-module");' + + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') + const newCode = replacer(code) + expect(newCode).toMatchSnapshot() + // So there should be no pure css chunk anymore + expect(newCode.match(/pure_css_chunk\.js/)).toBeNull() + }) */ + + /* Currently broken as the code is not valid + test('replaces require call in minified code that uses comma operator followed by assignment', () => { + const code = 'require("some-module"),require("pure_css_chunk.js");const v=require("other-module");' + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') + expect(replacer(code)).toMatchSnapshot() + }) */ +}) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 85ba5eea8e5b89..eed2bb87c9c76f 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -6,6 +6,8 @@ import glob from 'fast-glob' import postcssrc from 'postcss-load-config' import type { ExistingRawSourceMap, + ModuleFormat, + OutputBundle, OutputChunk, RenderedChunk, RollupError, @@ -735,44 +737,8 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { (pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName], ) - const emptyChunkFiles = pureCssChunkNames - .map((file) => path.basename(file)) - .join('|') - .replace(/\./g, '\\.') - const emptyChunkRE = new RegExp( - opts.format === 'es' - ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?` - : `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`, - 'g', - ) - for (const file in bundle) { - const chunk = bundle[file] - if (chunk.type === 'chunk') { - // remove pure css chunk from other chunk's imports, - // and also register the emitted CSS files under the importer - // chunks instead. - chunk.imports = chunk.imports.filter((file) => { - if (pureCssChunkNames.includes(file)) { - const { importedCss, importedAssets } = ( - bundle[file] as OutputChunk - ).viteMetadata! - importedCss.forEach((file) => - chunk.viteMetadata!.importedCss.add(file), - ) - importedAssets.forEach((file) => - chunk.viteMetadata!.importedAssets.add(file), - ) - return false - } - return true - }) - chunk.code = chunk.code.replace( - emptyChunkRE, - // remove css import while preserving source map location - (m) => `/* empty css ${''.padEnd(m.length - 15)}*/`, - ) - } - } + removePureCssChunks(bundle, pureCssChunkNames, opts.format) + const removedPureCssFiles = removedPureCssFilesCache.get(config)! pureCssChunkNames.forEach((fileName) => { removedPureCssFiles.set(fileName, bundle[fileName] as RenderedChunk) @@ -818,6 +784,79 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { } } +/** + * Create a replacer function that takes code and replaces given pure CSS chunk imports + * @param pureCssChunkNames The chunks that only contain pure CSS and should be replaced + * @param outputFormat The module output format to decide whether to replace `import` or `require` + */ +export function getEmptyChunkReplacer( + pureCssChunkNames: string[], + outputFormat: ModuleFormat, +): (code: string) => string { + const emptyChunkFiles = pureCssChunkNames + .map((file) => path.basename(file)) + .join('|') + .replace(/\./g, '\\.') + + // require and import calls might be chained by minifier using the comma operator + // in this case we have to keep one comma + // if a next require is chained or add a semicolon to terminate the chain. + const emptyChunkRE = new RegExp( + outputFormat === 'es' + ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?` + : `\\brequire\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\);\n?`, + 'g', + ) + + return (code: string) => + code.replace( + emptyChunkRE, + // remove css import while preserving source map location + (m) => `/* empty css ${''.padEnd(m.length - 15)}*/`, + ) +} + +/** + * Remove pure CSS chunks from the output bundle + * @param bundle The output bundle + * @param pureCssChunkNames Array of pure CSS chunk names + * @param outputFormat The current output format, to decide whether `require` or `import` is used + */ +export function removePureCssChunks( + bundle: OutputBundle, + pureCssChunkNames: string[], + outputFormat: ModuleFormat, +): void { + const replaceEmptyChunk = getEmptyChunkReplacer( + pureCssChunkNames, + outputFormat, + ) + + for (const file in bundle) { + const chunk = bundle[file] + if (chunk.type === 'chunk') { + // remove pure css chunk from other chunk's imports, + // and also register the emitted CSS files under the importer + // chunks instead. + chunk.imports = chunk.imports.filter((file) => { + if (pureCssChunkNames.includes(file)) { + const { importedCss, importedAssets } = (bundle[file] as OutputChunk) + .viteMetadata! + importedCss.forEach((file) => + chunk.viteMetadata!.importedCss.add(file), + ) + importedAssets.forEach((file) => + chunk.viteMetadata!.importedAssets.add(file), + ) + return false + } + return true + }) + chunk.code = replaceEmptyChunk(chunk.code) + } + } +} + interface CSSAtImportResolvers { css: ResolveFn sass: ResolveFn From 73a6a17b65c26abd0b20210368cab1d6c333a407 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 9 Oct 2023 15:47:50 +0800 Subject: [PATCH 2/4] refactor: reduce changes --- .../plugins/__snapshots__/css.spec.ts.snap | 31 ---- .../src/node/__tests__/plugins/css.spec.ts | 158 ++++-------------- packages/vite/src/node/plugins/css.ts | 74 ++++---- 3 files changed, 65 insertions(+), 198 deletions(-) delete mode 100644 packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap diff --git a/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap b/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap deleted file mode 100644 index 1532ca7ddf1e85..00000000000000 --- a/packages/vite/src/node/__tests__/plugins/__snapshots__/css.spec.ts.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`getEmptyChunkReplacer > replaces import call 1`] = ` -"import \\"some-module\\"; -/* empty css */import \\"other-module\\";" -`; - -exports[`getEmptyChunkReplacer > replaces require call 1`] = ` -"require(\\"some-module\\"); -/* empty css */require(\\"other-module\\");" -`; - -exports[`getEmptyChunkReplacer > replaces require call in minified code without new lines 1`] = `"require(\\"some-module\\");/* empty css */require(\\"other-module\\");"`; - -exports[`removePureCssChunks > import of removed chunk is dropped 1`] = ` -"import \\"some-module\\"; -/* empty css */import \\"other-module\\"; -" -`; - -exports[`removePureCssChunks > imported assets of css chunk are transfered 1`] = ` -"import \\"some-module\\"; -/* empty css */import \\"other-module\\"; -" -`; - -exports[`removePureCssChunks > require of removed chunk is dropped 1`] = ` -"require(\\"some-module\\"); -/* empty css */require(\\"other-module\\"); -" -`; diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index d641a5b1719b2c..dc694c0d8a877f 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -10,7 +10,6 @@ import { cssUrlRE, getEmptyChunkReplacer, hoistAtRules, - removePureCssChunks, } from '../../plugins/css' describe('search css url function', () => { @@ -262,141 +261,56 @@ describe('convertTargets', () => { }) }) -describe('removePureCssChunks', () => { - test('import of removed chunk is dropped', () => { - const bundle: OutputBundle = { - 'main.js': { - code: 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";\n', - imports: ['pure_css_chunk.js', 'some-module', 'other-module'], - type: 'chunk', - viteMetadata: { - importedAssets: new Set(), - importedCss: new Set(), - }, - } as any as OutputChunk, - 'pure_css_chunk.js': { - type: 'chunk', - code: '', - imports: [], - viteMetadata: { - importedAssets: new Set(), - importedCss: new Set(), - }, - } as any as OutputChunk, - } - - removePureCssChunks(bundle, ['pure_css_chunk.js'], 'es') - - const chunk = bundle['main.js'] as OutputChunk - expect(chunk.code).toMatchSnapshot() - // import is removed - expect(chunk.imports).toEqual(['some-module', 'other-module']) - }) - - test('require of removed chunk is dropped', () => { - const bundle: OutputBundle = { - 'main.js': { - code: 'require("some-module");\nrequire("pure_css_chunk.js");\nrequire("other-module");\n', - imports: ['pure_css_chunk.js', 'some-module', 'other-module'], - type: 'chunk', - viteMetadata: { - importedAssets: new Set(), - importedCss: new Set(), - }, - } as any as OutputChunk, - 'pure_css_chunk.js': { - type: 'chunk', - code: '', - imports: [], - viteMetadata: { - importedAssets: new Set(), - importedCss: new Set(), - }, - } as any as OutputChunk, - } - - removePureCssChunks(bundle, ['pure_css_chunk.js'], 'cjs') - - const chunk = bundle['main.js'] as OutputChunk - expect(chunk.code).toMatchSnapshot() - // import is removed - expect(chunk.imports).toEqual(['some-module', 'other-module']) - }) +describe('getEmptyChunkReplacer', () => { + test('replaces import call', () => { + const code = `\ +import "some-module"; +import "pure_css_chunk.js"; +import "other-module";` - test('imported assets of css chunk are transfered', () => { - const bundle: OutputBundle = { - 'main.js': { - code: 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";\n', - imports: ['pure_css_chunk.js', 'some-module', 'other-module'], - type: 'chunk', - viteMetadata: { - importedAssets: new Set(), - importedCss: new Set(), - }, - } as any as OutputChunk, - 'pure_css_chunk.js': { - type: 'chunk', - code: '', - imports: [], - viteMetadata: { - importedAssets: new Set(['some-asset.svg']), - importedCss: new Set(['some-style.css']), - }, - } as any as OutputChunk, - } - - removePureCssChunks(bundle, ['pure_css_chunk.js'], 'es') - - const chunk = bundle['main.js'] as OutputChunk - expect(chunk.code).toMatchSnapshot() - // import is removed - expect(chunk.imports).toEqual(['some-module', 'other-module']) - // metadata is transfered - expect(chunk.viteMetadata?.importedAssets.has('some-asset.svg')).toBe(true) - expect(chunk.viteMetadata?.importedCss.has('some-style.css')).toBe(true) + const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'es') + const replaced = replacer(code) + expect(replaced.length).toBe(code.length) + expect(replaced).toMatchInlineSnapshot(` + "import \\"some-module\\"; + /* empty css */import \\"other-module\\";" + `) }) -}) -describe('getEmptyChunkReplacer', () => { - test('replaces import call', () => { - const code = - 'import "some-module";\nimport "pure_css_chunk.js";\nimport "other-module";' + test('replaces import call without new lines', () => { + const code = `import "some-module";import "pure_css_chunk.js";import "other-module";` const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'es') - expect(replacer(code)).toMatchSnapshot() + const replaced = replacer(code) + expect(replaced.length).toBe(code.length) + expect(replaced).toMatchInlineSnapshot( + '"import \\"some-module\\";/* empty css */import \\"other-module\\";"', + ) }) test('replaces require call', () => { - const code = - 'require("some-module");\nrequire("pure_css_chunk.js");\nrequire("other-module");' + const code = `\ +require("some-module"); +require("pure_css_chunk.js"); +require("other-module");` const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') - expect(replacer(code)).toMatchSnapshot() + const replaced = replacer(code) + expect(replaced.length).toBe(code.length) + expect(replaced).toMatchInlineSnapshot(` + "require(\\"some-module\\"); + /* empty css */require(\\"other-module\\");" + `) }) test('replaces require call in minified code without new lines', () => { - const code = - 'require("some-module");require("pure_css_chunk.js");require("other-module");' + const code = `require("some-module");require("pure_css_chunk.js");require("other-module");` const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') - expect(replacer(code)).toMatchSnapshot() + const replaced = replacer(code) + expect(replaced.length).toBe(code.length) + expect(replaced).toMatchInlineSnapshot( + '"require(\\"some-module\\");/* empty css */require(\\"other-module\\");"', + ) }) - - /* Currently broken as the code still contains the css chunk - test('replaces require call in minified code that uses comma operator', () => { - const code = 'require("some-module"),require("pure_css_chunk.js"),require("other-module");' - - const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') - const newCode = replacer(code) - expect(newCode).toMatchSnapshot() - // So there should be no pure css chunk anymore - expect(newCode.match(/pure_css_chunk\.js/)).toBeNull() - }) */ - - /* Currently broken as the code is not valid - test('replaces require call in minified code that uses comma operator followed by assignment', () => { - const code = 'require("some-module"),require("pure_css_chunk.js");const v=require("other-module");' - const replacer = getEmptyChunkReplacer(['pure_css_chunk.js'], 'cjs') - expect(replacer(code)).toMatchSnapshot() - }) */ }) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index eed2bb87c9c76f..07247a25686e58 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -737,7 +737,35 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin { (pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName], ) - removePureCssChunks(bundle, pureCssChunkNames, opts.format) + const replaceEmptyChunk = getEmptyChunkReplacer( + pureCssChunkNames, + opts.format, + ) + + for (const file in bundle) { + const chunk = bundle[file] + if (chunk.type === 'chunk') { + // remove pure css chunk from other chunk's imports, + // and also register the emitted CSS files under the importer + // chunks instead. + chunk.imports = chunk.imports.filter((file) => { + if (pureCssChunkNames.includes(file)) { + const { importedCss, importedAssets } = ( + bundle[file] as OutputChunk + ).viteMetadata! + importedCss.forEach((file) => + chunk.viteMetadata!.importedCss.add(file), + ) + importedAssets.forEach((file) => + chunk.viteMetadata!.importedAssets.add(file), + ) + return false + } + return true + }) + chunk.code = replaceEmptyChunk(chunk.code) + } + } const removedPureCssFiles = removedPureCssFilesCache.get(config)! pureCssChunkNames.forEach((fileName) => { @@ -798,9 +826,6 @@ export function getEmptyChunkReplacer( .join('|') .replace(/\./g, '\\.') - // require and import calls might be chained by minifier using the comma operator - // in this case we have to keep one comma - // if a next require is chained or add a semicolon to terminate the chain. const emptyChunkRE = new RegExp( outputFormat === 'es' ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];\n?` @@ -816,47 +841,6 @@ export function getEmptyChunkReplacer( ) } -/** - * Remove pure CSS chunks from the output bundle - * @param bundle The output bundle - * @param pureCssChunkNames Array of pure CSS chunk names - * @param outputFormat The current output format, to decide whether `require` or `import` is used - */ -export function removePureCssChunks( - bundle: OutputBundle, - pureCssChunkNames: string[], - outputFormat: ModuleFormat, -): void { - const replaceEmptyChunk = getEmptyChunkReplacer( - pureCssChunkNames, - outputFormat, - ) - - for (const file in bundle) { - const chunk = bundle[file] - if (chunk.type === 'chunk') { - // remove pure css chunk from other chunk's imports, - // and also register the emitted CSS files under the importer - // chunks instead. - chunk.imports = chunk.imports.filter((file) => { - if (pureCssChunkNames.includes(file)) { - const { importedCss, importedAssets } = (bundle[file] as OutputChunk) - .viteMetadata! - importedCss.forEach((file) => - chunk.viteMetadata!.importedCss.add(file), - ) - importedAssets.forEach((file) => - chunk.viteMetadata!.importedAssets.add(file), - ) - return false - } - return true - }) - chunk.code = replaceEmptyChunk(chunk.code) - } - } -} - interface CSSAtImportResolvers { css: ResolveFn sass: ResolveFn From 2a39f63eee17c3775a2ab8c8494ff62c298095f5 Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 9 Oct 2023 15:51:01 +0800 Subject: [PATCH 3/4] chore: fix lint --- packages/vite/src/node/plugins/css.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 07247a25686e58..133370be37036d 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -7,7 +7,6 @@ import postcssrc from 'postcss-load-config' import type { ExistingRawSourceMap, ModuleFormat, - OutputBundle, OutputChunk, RenderedChunk, RollupError, From ed248515e02f12dd8dd8ba15d215ac688487b48c Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 9 Oct 2023 15:57:45 +0800 Subject: [PATCH 4/4] chore: fix lint again --- packages/vite/src/node/__tests__/plugins/css.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/vite/src/node/__tests__/plugins/css.spec.ts b/packages/vite/src/node/__tests__/plugins/css.spec.ts index dc694c0d8a877f..d206e5b73e90d1 100644 --- a/packages/vite/src/node/__tests__/plugins/css.spec.ts +++ b/packages/vite/src/node/__tests__/plugins/css.spec.ts @@ -1,7 +1,6 @@ import fs from 'node:fs' import path from 'node:path' import { describe, expect, test, vi } from 'vitest' -import type { OutputBundle, OutputChunk } from 'rollup' import { resolveConfig } from '../../config' import type { InlineConfig } from '../../config' import {