fix(css): remove pure css chunk sourcemap (#14290)

This commit is contained in:
sun0day 2023-09-06 02:27:52 +08:00 committed by GitHub
parent 34826aae01
commit 2b80089491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 0 deletions

View File

@ -786,6 +786,7 @@ export function cssPostPlugin(config: ResolvedConfig): Plugin {
pureCssChunkNames.forEach((fileName) => {
removedPureCssFiles.set(fileName, bundle[fileName] as RenderedChunk)
delete bundle[fileName]
delete bundle[`${fileName}.map`]
})
}

View File

@ -0,0 +1,8 @@
import { describe, expect, test } from 'vitest'
import { findAssetFile, isBuild } from '~utils'
describe.runIf(isBuild)('css lib entry', () => {
test('remove useless js sourcemap', async () => {
expect(findAssetFile('linked.js.map', 'lib-entry', './')).toBe('')
})
})

View File

@ -0,0 +1 @@
export default 'hello'

View File

@ -0,0 +1,13 @@
import { defineConfig } from 'vite'
export default defineConfig({
build: {
cssCodeSplit: true,
sourcemap: true,
outDir: 'dist/lib-entry',
lib: {
entry: ['./index.js', './linked.css'],
formats: ['es'],
},
},
})