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

Fix broken metafile with css import from js #504

Merged
merged 1 commit into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1303,19 +1303,26 @@ func (b *Bundle) generateMetadataJSON(results []OutputFile, asciiOnly bool) []by
j.AddString("{\n \"inputs\": {")

// Write inputs
for i, item := range sorted {
if i > 0 {
j.AddString(",\n ")
} else {
isFirst := true
for _, item := range sorted {
file := b.files[item.sourceIndex]
// Do not include this file if it is a js stub for a css file.
if repr, ok := file.repr.(*reprJS); ok && repr.cssSourceIndex != nil {
continue
}
if isFirst {
isFirst = false
j.AddString("\n ")
} else {
j.AddString(",\n ")
}
j.AddBytes(b.files[item.sourceIndex].jsonMetadataChunk)
j.AddBytes(file.jsonMetadataChunk)
}

j.AddString("\n },\n \"outputs\": {")

// Write outputs
isFirst := true
isFirst = true
for _, result := range results {
if len(result.jsonMetadataChunk) > 0 {
if isFirst {
Expand Down