Skip to content
New issue

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

Fix lab build prod #6907

Merged
merged 4 commits into from Aug 1, 2019
Merged

Commits on Jul 31, 2019

  1. Fix production build

    With the `TerserPlugin` enabled, the build fails with:
    
    ```
    ~/.local/share/virtualenvs/project-QesvCi_o/share/jupyter/lab/staging
    ❯ node yarn.js webpack --config webpack.prod.config.js --progress
    yarn run v1.15.2
    $ /Users/me/.local/share/virtualenvs/project-QesvCi_o/share/jupyter/lab/staging/node_modules/.bin/webpack --config webpack.prod.config.js --progress
     97% [0] chunk asset optimization TerserPlugin
    <--- Last few GCs --->
    
    [88233:0x108000000]    26766 ms: Scavenge 1392.5 (1420.9) -> 1391.9 (1421.9) MB, 2.2 / 0.0 ms  (average mu = 0.067, current mu = 0.029) allocation failure
    
    <--- JS stacktrace --->
    
    ==== JS stack trace =========================================
    
        0: ExitFrame [pc: 0x2b3e51fdbe3d]
    Security context: 0x1b222981e6e9 <JSObject>
        1: _walk [0x1b2248a66fc1] [/Users/me/.local/share/virtualenvs/project-QesvCi_o/share/jupyter/lab/staging/node_modules/terser/dist/bundle.min.js:~1] [pc=0x2b3e5223920d](this=0x1b225aef3559 <AST_String map = 0x1b22fdfd8419>,e=0x1b22c00c09c1 <En map = 0x1b22fdfe44f1>)
        2: /* anonymous */ [0x1b22d2ca1001] [/Users/me/.local/share/virtualenvs/chouke...
    
    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
     1: 0x10003cf99 node::Abort() [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     2: 0x10003d1a3 node::OnFatalError(char const*, char const*) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     3: 0x1001b7835 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     4: 0x100585682 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     5: 0x100588155 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     6: 0x100583fff v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     7: 0x1005821d4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     8: 0x10058ea6c v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
     9: 0x10058eaef v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
    10: 0x10055e434 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
    11: 0x1007e6714 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/me/.asdf/installs/nodejs/10.16.0/bin/node]
    12: 0x2b3e51fdbe3d
    13: 0x2b3e5223920d
    14: 0x2b3e51f918d5
    15: 0x2b3e5223a1f7
    ```
    
    Even on powerful laptops such as a MacBook Pro with a 2,3 GHz Intel Core i9 and 32 GB 2400 MHz DDR4.
    
    The Node.js process would never exit and thus commands like:
    
    ```
    jupyter labextension install @jupyterlab/plotly-extension --dev-build False
    ```
    
    would never exit too but without telling why (see jupyterlab#4276).
    
    I've tried a bunch of different terser options but I could not find a combination that would succeed when installing relatively big JupyterLab extensions.
    So I resort to disabling minification altogether. I think it's better to have a fat production build than no production build at all.
    tibdex authored and telamonian committed Jul 31, 2019
    Copy the full SHA
    c1a5803 View commit details
    Browse the repository at this point in the history
  2. Default to production build

    Now that the production build is fixed, I think it's better to default to it. Indeed, we want users installing JupyterLab to have the best experience using the interface and it means running the optimized production build.
    
    This is especially true for extensions built with React because in dev mode, they will use the React's development bundle which is known to be much slower than the production one.
    
    See also: jupyterlab#6804 (comment)
    tibdex authored and telamonian committed Jul 31, 2019
    Copy the full SHA
    e70ce00 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    7e69eeb View commit details
    Browse the repository at this point in the history
  4. jupyter lab build defaults to dev if any linked_packages or local_e…

    …xtensions
    
    defaults to prod build otherwise
    telamonian committed Jul 31, 2019
    Copy the full SHA
    f7f3fb8 View commit details
    Browse the repository at this point in the history