-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(preset-umi): resolve esbuild minify naming conflicts #10585
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +10.8 kB (0%) Total Size: 9.59 MB
ℹ️ View Unchanged
|
Codecov ReportBase: 29.21% // Head: 28.97% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #10585 +/- ##
==========================================
- Coverage 29.21% 28.97% -0.25%
==========================================
Files 452 453 +1
Lines 13414 13454 +40
Branches 3157 3166 +9
==========================================
- Hits 3919 3898 -21
- Misses 8835 8888 +53
- Partials 660 668 +8
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
packages/preset-umi/src/features/webpack/plugins/EsbuildMinifyFix.ts
Outdated
Show resolved
Hide resolved
packages/preset-umi/src/features/webpack/plugins/EsbuildMinifyFix.ts
Outdated
Show resolved
Hide resolved
packages/preset-umi/src/features/webpack/plugins/EsbuildMinifyFix.ts
Outdated
Show resolved
Hide resolved
packages/preset-umi/src/features/webpack/plugins/EsbuildMinifyFix.ts
Outdated
Show resolved
Hide resolved
9147927
to
cc97ff9
Compare
@PeachScript MagicString 走预打包了 我测试是没有影响的 可以关注下 对 esmi有没有影响 |
const output: any = {}; | ||
|
||
if (map) { | ||
output.source = new SourceMapSource(code, name, map, source, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方有些问题,源码在:https://github.com/webpack/webpack-sources/blob/main/lib/SourceMapSource.js
函数签名是:
constructor(
sourceCode: string,
name: string,
sourceMap: SourceMapGenerator | RawSourceMap,
originalSource?: string,
innerSourceMap?: RawSourceMap | string,
removeOriginalSource?: boolean,
);
正确的应该是:
const sourcemap =
this.options.sourceMap === undefined
? ((devtool && (devtool as string).includes('source-map')) as boolean)
: this.options.sourceMap
if (sourcemap) {
const originCode = source.toString()
new SourceMapSource(code, name, map, originCode, map, true);
}
尝试解决 esbuild 压缩 命名冲突的问题
![image](https://user-images.githubusercontent.com/7599351/220808889-720af4ea-1845-47ca-8bc9-e08e82b99915.png)
![image](https://user-images.githubusercontent.com/7599351/220808909-c530e403-e750-44d7-a48b-8e740a8a3832.png)
目前判断一定规则不会增加 iife
通过
esbuildMinifyIIFE
手动开启