feat(mp): 支持npm link&monorepo等不在root路径下的软链接引用 #5108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
将npm link/mpnorepo等软链接的引入路径的产物路径格式化到当前根目录下
原有实现:直接设置resolve.preserveSymlinks = true,在monorepo下,嵌套的对同一个包的引用会导致重复打包多次
vite在resolverId时解析的package.json路径是软连接的,嵌套的node_modules下的引用导致对同一个包的引用resolve出不同的id vite:resolve packages
normalizeMiniProgramFilename这里如果支持引用不在根路径下的外部依赖,至少提供了用户可以不开启preserveSymlinks 的选择
相关问题:关于monorepo开发项目,相同package被重复编译至vendor.js