Skip to content

Commit 4b9b26c

Browse files
committed
fix: avoid id inconsitency caused by CRLF
See #1706
1 parent 2e98ea6 commit 4b9b26c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ export default function loader(
116116
.relative(rootContext || process.cwd(), resourcePath)
117117
.replace(/^(\.\.[\/\\])+/, '')
118118
const shortFilePath = rawShortFilePath.replace(/\\/g, '/') + resourceQuery
119-
const id = hash(isProduction ? shortFilePath + '\n' + source : shortFilePath)
119+
const id = hash(
120+
isProduction
121+
? shortFilePath + '\n' + source.replace(/\r\n/g, '\n')
122+
: shortFilePath
123+
)
120124

121125
// feature information
122126
const hasScoped = descriptor.styles.some((s) => s.scoped)

0 commit comments

Comments
 (0)