Skip to content

Commit

Permalink
fix: make sure asset reference id could be a valid identifier (rolldo…
Browse files Browse the repository at this point in the history
…wn#2198)

<!-- Thank you for contributing! -->

### Description

<!-- Please insert your description here and provide especially info
about the "what" this PR is solving -->

close rolldown/vite#27 (comment)

ref
https://github.com/rollup/rollup/blob/master/src/utils/FileEmitter.ts#L300
  • Loading branch information
underfin authored Sep 9, 2024
1 parent e36915a commit 7752238
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/rolldown_common/src/file_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ impl FileEmitter {
})
.as_bytes(),
)
// The reference id can be used for import.meta.ROLLUP_FILE_URL_referenceId and therefore needs to be a valid identifier.
.replace('-', "$")
.into()
}

Expand Down

0 comments on commit 7752238

Please sign in to comment.