-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix/browserslist #10389
Fix/browserslist #10389
Conversation
|
||
function fixBrowserslist(target) { | ||
const content = fs.readFileSync(target, 'utf-8'); | ||
const match = content.match(/require\(__(webpack|nccwpck)_require__\((\S*)\).resolve/); |
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.
const match = content.match(/require\(__(webpack|nccwpck)_require__\((\S*)\).resolve/); | |
const match = content.match(/require\(__(webpack|nccwpck)_require__\((\d+)\).resolve/); |
|
||
function fixBrowserslist(target) { | ||
const content = fs.readFileSync(target, 'utf-8'); | ||
const match = content.match(/require\(__(webpack|nccwpck)_require__\((\S*)\).resolve/); |
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.
为什么会存在 nccwpck 和 webpack 两种变量名,是不同 ncc 版本引起的?
更好的解法是找到 browserslist 这个包的位置(以 babel 为 base 起点解析),直接把源码里 |
应该把所有的 |
我在 #10396 提了一个 umi 4 可靠的解法,比较复杂。 由于 umi 4 不能使用 browserslist ,所以会报错也是合理的,对 umi 4 修复该问题,我持中立态度。 关于 umi 3 了解的不多,如果没有配置 browserslist 的设计,不建议修复该问题。 |
Umi 3 有 browserslist 的配置的。 |
umi 3 还处理嘛 |
1410656
to
00ba148
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
00ba148
to
1410656
Compare
c376468
to
1329b40
Compare
64ec0b0
to
d664561
Compare
d664561
to
aac42e6
Compare
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.
+1
修复 browserslist 预打包产物中 require.resolve 报错
close #10356