NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.48k stars 4.79k forks source link

exceeds the max of 500KB #7183

Closed linyongfu2013 closed 4 years ago

linyongfu2013 commented 4 years ago

相关平台

微信小程序

复现仓库

https://github.com/linyongfu2013/taro-demo3 小程序基础库: 2.12.0 使用框架: React

复现步骤

taro init 创建工程后,在任意页面添加 Taro.getLocation 方法,编译无法通过,最后报OOM

期望结果

正常运行

实际结果

报异常,无法编译

环境信息

👽 Taro v3.0.5

  Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node
      Yarn: 1.22.4 - ~/.nvm/versions/node/v12.18.3/bin/yarn
      npm: 6.14.7 - ~/.nvm/versions/node/v12.18.3/bin/npm
    npmPackages:
      @tarojs/cli: 3.0.5 => 3.0.5
      @tarojs/components: 3.0.5 => 3.0.5
      @tarojs/mini-runner: 3.0.5 => 3.0.5
      @tarojs/react: 3.0.5 => 3.0.5
      @tarojs/runtime: 3.0.5 => 3.0.5
      @tarojs/taro: 3.0.5 => 3.0.5
      @tarojs/webpack-runner: 3.0.5 => 3.0.5
      babel-preset-taro: 3.0.5 => 3.0.5
      eslint-config-taro: 3.0.5 => 3.0.5
      react: ^16.10.0 => 16.13.1
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.3
linyongfu2013 commented 4 years ago

异常日志

编译  发现入口  src/app.js
编译  发现页面  src/pages/index/index.jsx
⠸ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/react-reconciler/cjs/react-reconciler.development.js as it exceeds the max of 500KB.
⠇ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/@tarojs/cli/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠙ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/prettier/index.js as it exceeds the max of 500KB.
⠴ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/inquirer/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠇ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/@tarojs/taroize/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠏ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/npm-check/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠼ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/eslint/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠧ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/depcheck/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠇ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/@tarojs/transformer-wx/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠏ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/typescript/lib/typescript.js as it exceeds the max of 500KB.
⠼ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/babel-plugin-transform-define/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠇ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/prettier/parser-flow.js as it exceeds the max of 500KB.
⠏ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
⠋ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of /Users/nuc8/WeChatProjects/taro-demo3/node_modules/prettier/parser-typescript.js as it exceeds the max of 500KB.
⠙ 正在编译...
<--- Last few GCs --->

[50181:0x110000000]   227126 ms: Mark-sweep 2027.4 (2068.0) -> 2021.5 (2051.5) MB, 179.5 / 0.0 ms  (+ 797.4 ms in 168 steps since start of marking, biggest step 9.8 ms, walltime since start of marking 1011 ms) (average mu = 0.242, current mu = 0.181) fina[50181:0x110000000]   228462 ms: Mark-sweep 2029.9 (2051.7) -> 2017.2 (2069.5) MB, 1133.8 / 0.0 ms  (average mu = 0.196, current mu = 0.151) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x1009d39b9]
    1: StubFrame [pc: 0x1009d537d]
    2: StubFrame [pc: 0x1009b34ac]
Security context: 0x076cda8408d1 <JSObject>
    3: split [0x76cda84cd51](this=0x076c0cb2ed39 <String[123]: /Users/nuc8/WeChatProjects/taro-demo3/node_modules/@babel/plugin-transform-unicode-regex/node_modules/lodash/_equalByTag.js>,0x076ce5101091 <JSRegExp <String[#3]: \/+>>)
    4: /* anonymous */ [0x76cdfbdf179] [/Users/nuc8/WeChatPr...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1011c2ff5 node::Abort() (.cold.1) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 2: 0x10009fbc9 node::Abort() [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 3: 0x10009fd2f node::OnFatalError(char const*, char const*) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 4: 0x1001e3907 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 5: 0x1001e38a7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 6: 0x1003695e5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 7: 0x10036ae3a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 8: 0x1003678be v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
 9: 0x100365670 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
10: 0x10037149a v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
11: 0x100371521 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
12: 0x10033f73a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
13: 0x10068e808 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
14: 0x1009d39b9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
15: 0x1009d537d Builtins_SubString [/Users/nuc8/.nvm/versions/node/v12.18.3/bin/node]
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Chen-jj commented 4 years ago

@linyongfu2013 Taro 引用错了:

import Taro from 'tarojs/taro'

另外不需要调用 Taro API 的文件不需要引入 Taro