Skip to content

Conversation

shiftj18
Copy link
Contributor

@shiftj18 shiftj18 commented Sep 8, 2022

rax-platform-loader 修改

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

    // fix babel-plugin-minify-dead-code-elimination bug.
    // only remove like: var isWeex = false; if(isWeex){ xxx }
    // don't remove like: var _universalEnv = {isWeex: false}; if(_universalEnv.isWeex){ xxx }
    // change _universalEnv.isWeex to false

@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #1018 (50e66a0) into master (b819b27) will increase coverage by 0.11%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1018      +/-   ##
==========================================
+ Coverage   49.76%   49.88%   +0.11%     
==========================================
  Files          48       48              
  Lines        1282     1285       +3     
  Branches      296      297       +1     
==========================================
+ Hits          638      641       +3     
  Misses        644      644              
Impacted Files Coverage Δ
packages/platform-loader/src/index.js 57.89% <60.00%> (-0.93%) ⬇️
packages/platform-loader/src/TraverseImport.js 67.60% <100.00%> (+2.32%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants