|
function resolveGlob(glob: string) { |
|
if (glob.startsWith('!')) |
|
return `!${slash(path.resolve(root, glob.slice(1)))}` |
|
return slash(path.resolve(root, glob)) |
|
} |
这里直接拼root的方法对于想要exclude pnpm安装的node_modules会有问题:webpack插件context的resourcePath都是原始路径不是链接路径,所以scanOptions.exclude中的node_modules全部都不会按照预期的生效,它依旧会处理一些第三方库,比如
../../node_modules/.pnpm/@arco-design+web-react@2.34.0_toktsx4rp6zr3oxhhtw5ts6lt4/node_modules/@arco-design/web-react/es/Menu/style/index.less这样的文件(../../对应的其实是我最外层主项目的packages/whatever-package-name),然后触发一个解析错误

vite-plugin-windicss/packages/plugin-utils/src/resolveOptions.ts
Lines 112 to 116 in a9a6ffa
../../node_modules/.pnpm/@arco-design+web-react@2.34.0_toktsx4rp6zr3oxhhtw5ts6lt4/node_modules/@arco-design/web-react/es/Menu/style/index.less这样的文件(../../对应的其实是我最外层主项目的packages/whatever-package-name),然后触发一个解析错误