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

Minification breaks regenerator-runtime package and redux-saga is not usable #86

Closed
navarroaxel opened this issue Nov 7, 2017 · 1 comment

Comments

@navarroaxel
Copy link

navarroaxel commented Nov 7, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
The regenerator-runtime@0.10.5/runtime.js is not minified properly. Throwing the following error:

ExceptionsManager.js:73 uncaught at n at n 
 ReferenceError: record is not defined
    at Generator._invoke (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:221:931)
    at Generator.t.(anonymous function) [as next] (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:221:1352)
    at t (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:869:536)
    at o (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:869:7374)
    at t.runSaga (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:867:806)
    at o.default (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:865:440)
    at http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:514:173
    at t (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:2:1273)
    at http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:2:614
    at n (http://localhost:8081/index.android.bundle?platform=android&dev=true&minify=true:2:622)

This is the original code:

var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {

This is the minified:

if (o = b, "normal" === (record = n(t, r, e)).type) {

The regenerator-runtime/runtime.js has this header with strict mode enabled (this cause the error):

!(function(global) {
  "use strict";

With this error the redux-saga package is unusable and the whole app is broken.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?
The record variable is well defined. Work fine on:

react-native@0.49.3
metro-bundler@0.13.0

Please provide your exact metro-bundler configuration and mention your metro-bundler, node, yarn/npm version and operating system.

node@6.11.5
yarn@1.13.2
metro-bundler@0.20.0
react-native@0.50.1
regenerator-runtime@0.10.5
redux-saga@0.16.0
OS: Ubuntu MATE 16.04.3 LTS
@navarroaxel navarroaxel changed the title Minification breaks regenerator-runtime package and the react-native app is not usable Minification breaks regenerator-runtime package and redux-saga is not usable Nov 7, 2017
@rafeca
Copy link
Contributor

rafeca commented Nov 7, 2017

@navarroaxel I have just released metro-bundler@0.20.1 with an upgraded uglify version, which hopefully will fix this.

You can force yarn to use the new metro version by forcing a resolution in your package.json:

"resolutions": {
  "metro-bundler": "0.20.1"
}

Please reopen the issue if this does not fix it

@rafeca rafeca closed this as completed Nov 7, 2017
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

No branches or pull requests

2 participants