rollup打包js,match方法没有被tree shaking

export const isIOS: boolean = !!window.navigator.userAgent.match(
/(i[^;]+;( U;)? CPU.+Mac OS X/
); // ios终端
没有导入isIOS,但代码却打包进去了

export const isIOS: boolean = /(i[^;]+;( U;)? CPU.+Mac OS X/.test(ua); // ios终端
没有导入isIOS,就没有打包进去

posted @ 2024-05-14 17:42  冰冰biu  阅读(12)  评论(0)    收藏  举报