Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group CSS files in shared build output separate from JS files #11184

Merged
merged 2 commits into from Mar 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 26 additions & 15 deletions packages/next/build/utils.ts
Expand Up @@ -204,21 +204,32 @@ export async function printTreeView(
const sharedFiles = sizeData.sizeCommonFile

messages.push(['+ shared by all', getPrettySize(sharedFilesSize), ''])
Object.keys(sharedFiles)
.map(e => e.replace(buildId, '<buildId>'))
.sort()
.forEach((fileName, index, { length }) => {
const innerSymbol = index === length - 1 ? '└' : '├'

const originalName = fileName.replace('<buildId>', buildId)
const cleanName = getCleanName(originalName)

messages.push([
` ${innerSymbol} ${cleanName}`,
prettyBytes(sharedFiles[originalName]),
'',
])
})
const sharedFileKeys = Object.keys(sharedFiles)
const sharedCssFiles: string[] = []
;[
...sharedFileKeys
.filter(file => {
if (file.endsWith('.css')) {
sharedCssFiles.push(file)
return false
}
return true
})
.map(e => e.replace(buildId, '<buildId>'))
.sort(),
...sharedCssFiles.map(e => e.replace(buildId, '<buildId>')).sort(),
].forEach((fileName, index, { length }) => {
const innerSymbol = index === length - 1 ? '└' : '├'

const originalName = fileName.replace('<buildId>', buildId)
const cleanName = getCleanName(fileName)

messages.push([
` ${innerSymbol} ${cleanName}`,
prettyBytes(sharedFiles[originalName]),
'',
])
})

console.log(
textTable(messages, {
Expand Down