How to prevent node from running out of memory when bundling js for React Native

前端 未结 5 1928
误落风尘
误落风尘 2021-01-02 06:01

When bundling js for React Native using ClojureScript I got the following error. It seems that node runs out of memory when bundling the javascript bundle. This is probably

5条回答
  •  别那么骄傲
    2021-01-02 06:12

    Another workaround is to disable optimizations by setting --dev true for production builds. This has performance drawbacks, but in my experience they are acceptable. Dev mode also enables a number of runtime checks. You can disable them by changing the DEV constant at the top of the bundle output, like so:

    #!/usr/bin/env python
    
    # Patch jsbundle to set __DEV__ to false
    
    import sys, re
    
    print(re.sub(r'__DEV__\s*=\s*true;', "__DEV__=false;",
            sys.stdin.read()))
    

提交回复
热议问题