Can not read rollup.external when it's type is RegExp
AttackXiaoJinJin opened this issue · 0 comments
AttackXiaoJinJin commented
Versions
- vite-plugin-federation: ^1.3.3
- vite: ^4.5.0
Reproduction
remote vite.config.js:
build:{
rollupOptions:{
external: [/^aaa/]
}
},
run build and:
THE CODE IS:
get external and use removeNonRegLetter
inputOptions.external = (inputOptions.external as [])?.filter(
(item) => {
return !shareName2Prop.has(removeNonRegLetter(item, NAME_CHAR_REG))
}
)
export function removeNonRegLetter(str: string, reg = letterReg): string {
let needUpperCase = false
let ret = ''
for (const c of str) {
if (reg.test(c)) {
ret += needUpperCase ? c.toUpperCase() : c
needUpperCase = false
} else {
needUpperCase = true
}
}
return ret
}
removeNonRegLetter
first param SHOULD BE string|RegExp
https://rollupjs.org/configuration-options/#external