We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
比如
https://github.com/opensumi/core/blob/6273dbac4c3e1879260482d85030b7257aaf09b0/packages/utils/src/os.ts#L64
包含代码,
export function getNodeRequire() { return typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require; }
其中 __webpack_require__ 会被认定为特殊语法,然后报错。
__webpack_require__
排除 typeof 的场景。
新增一个 visitor,在遇到 __webpack_require__ 等 webpack 特有语法时,转换为 typeof undefined。
typeof undefined
比如:
- return typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require; + return typeof undefined === 'function' ? __non_webpack_require__ : require;
这个一直修修补补,感觉需要一个更彻底的解,比如通过配置提供一个 webpack 常用 runtime 层的兼容补丁。
The text was updated successfully, but these errors were encountered:
单点的看这个问题 ,修改了之后三元表达式返回 require,如果在 platform web 的情况下,这个 require 应该会变成 __mako_require__ 不知道后继的逻辑还能不能对。
__mako_require__
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
问题
比如
https://github.com/opensumi/core/blob/6273dbac4c3e1879260482d85030b7257aaf09b0/packages/utils/src/os.ts#L64
包含代码,
其中
__webpack_require__
会被认定为特殊语法,然后报错。解法
排除 typeof 的场景。
新增一个 visitor,在遇到
__webpack_require__
等 webpack 特有语法时,转换为typeof undefined
。比如:
这个一直修修补补,感觉需要一个更彻底的解,比如通过配置提供一个 webpack 常用 runtime 层的兼容补丁。
The text was updated successfully, but these errors were encountered: