@@ -145,7 +145,7 @@ export function dedupeImports(imports: Import[], warn: (msg: string) => void) {
145145 if ( isSameSpecifier ) {
146146 if ( Boolean ( currImp . type ) === Boolean ( prevImp . type ) ) {
147147 // currImp and prevImp are the same import
148- if ( ( currImp . priority || 1 ) > ( prevImp . priority || 1 ) ) {
148+ if ( ( currImp . priority ?? 1 ) > ( prevImp . priority ?? 1 ) ) {
149149 deduped . delete ( name )
150150 deduped . set ( name , currImp )
151151 }
@@ -157,7 +157,7 @@ export function dedupeImports(imports: Import[], warn: (msg: string) => void) {
157157 if ( ! prevImpComplement ) {
158158 deduped . set ( altName , currImp )
159159 }
160- else if ( ( currImp . priority || 1 ) > ( prevImpComplement . priority || 1 ) ) {
160+ else if ( ( currImp . priority ?? 1 ) > ( prevImpComplement . priority ?? 1 ) ) {
161161 deduped . delete ( altName )
162162 deduped . set ( altName , currImp )
163163 }
@@ -168,7 +168,10 @@ export function dedupeImports(imports: Import[], warn: (msg: string) => void) {
168168 // currImp and prevImp are duplicate imports
169169 const altName = encodeImportName ( name )
170170 const prevImpComplement = deduped . get ( altName )
171- const priorityDiff = ( currImp . priority || 1 ) - Math . max ( prevImp . priority || 1 , prevImpComplement ?. priority || 1 )
171+ const prevPriority = prevImpComplement
172+ ? Math . max ( prevImp . priority ?? 1 , prevImpComplement . priority ?? 1 )
173+ : prevImp . priority ?? 1
174+ const priorityDiff = ( currImp . priority ?? 1 ) - prevPriority
172175 if ( priorityDiff > 0 ) {
173176 deduped . delete ( name )
174177 deduped . delete ( altName )
0 commit comments