Skip to content

Commit

Permalink
fix: check for regex in external (#573)
Browse files Browse the repository at this point in the history
Co-authored-by: Juan Díaz <[email protected]>
  • Loading branch information
JuanoD and Juan Díaz authored Feb 18, 2024
1 parent 0a09bf0 commit 7e5be49
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/lib/src/prod/shared-production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ export function prodSharedPlugin(

if (shareName2Prop.size) {
// remove item which is both in external and shared
inputOptions.external = (inputOptions.external as [])?.filter(
(item) => {
return !shareName2Prop.has(removeNonRegLetter(item, NAME_CHAR_REG))
}
)
inputOptions.external = (
inputOptions.external as (string | RegExp)[]
)?.filter((item) => {
if (item instanceof RegExp)
return ![...shareName2Prop.keys()].some((key) => item.test(key))
return !shareName2Prop.has(removeNonRegLetter(item, NAME_CHAR_REG))
})
}
return inputOptions
},
Expand Down

0 comments on commit 7e5be49

Please sign in to comment.