fix(platform-loader): await SourceMapConsumer and destroy #1018
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.
rax-platform-loader 修改
TypeError: Cannot read properties of undefined (reading '0')’
,原因是new SourceMapConsumer()
返回是 Promise,所以后续取值outputMapConsumer.sources[0]
报错,source-map对应文档。用法更正为 await,并且增加用完后的 destroy() ,释放空间。import { isWeex as iw } from 'universal-env';
转为了const isWeex = true;\n const iw = true;
的问题。被 Alias 为iw
的isWeex
变量赋值后,如果模块命名空间内用户有再声明isWeex
则会报错。这里去掉赋值,将其释放出来。_universalEnv = { isWeex: false }
这种剔除,测试目前最新版本 0.5.2 依然不支持。故这里将写死的替换_universalEnv.isWeex
为布尔值的逻辑,做成配置options.memberExpObjName
(同options.name
),便于用户自定义扩展支持其他分端 env 库 (比如 @ali/rxpi-env 的分端 tree-shaking)。