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

code minified for production is getting error merge is not a function #221

Open
tsdexter opened this issue May 29, 2017 · 2 comments
Open

Comments

@tsdexter
Copy link

I have code like this:

import Immutable from 'seamless-immutable';

export const initialState = Immutable({
  sidebarOpened: false,
  isMobile: false
})

export default function layout (state = initialState, action) {
  switch (action.type) {
    case commonTypes.APP_INIT:
      {
        let isMobile = false
        if(!SERVER){
          let { innerWidth } = window
          isMobile = innerWidth < 1025 // 1024px - is the main breakpoint in ui
        }
        return state.merge({
          isMobile: isMobile
        })
      }
    default: return state
    }
  }
}

it works fine in development but when I bundle/build for production I get the following error - not sure why - any ideas?

Uncaught TypeError: e.merge is not a function
    at r (browser.b704458….js:1)
    at vendor.d1edc2b….js:1
    at f (vendor.d1edc2b….js:1)
    at r (vendor.d1edc2b….js:1)
    at vendor.d1edc2b….js:1
    at r (vendor.d1edc2b….js:1)
    at r (browser.b704458….js:1)
    at Object.<anonymous> (browser.b704458….js:1)
    at Object.TBTs (browser.b704458….js:1)
    at r (manifest.d41d8cd….js:1)
r @ browser.b704458….js:1
(anonymous) @ vendor.d1edc2b….js:1
f @ vendor.d1edc2b….js:1
r @ vendor.d1edc2b….js:1
(anonymous) @ vendor.d1edc2b….js:1
r @ vendor.d1edc2b….js:1
r @ browser.b704458….js:1
(anonymous) @ browser.b704458….js:1
TBTs @ browser.b704458….js:1
r @ manifest.d41d8cd….js:1
0 @ browser.b704458….js:1
r @ manifest.d41d8cd….js:1
window.webpackJsonp @ manifest.d41d8cd….js:1
(anonymous) @ browser.b704458….js:1

which is triggered here:

function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s;switch(arguments[1].type){case i.a:var t=!1;return t=1025>window.innerWidth,e.merge({isMobile:t});
@tsdexter
Copy link
Author

@rtfeldman any idea what might be going on here? Here is some more info from dev tools... looks to me like e is definitely a function... not sure how to debug it further?

https://www.dropbox.com/s/4nwxd7r11d37uw4/Screen%20Shot%202017-05-31%20at%2011.20.28%20AM.png?dl=0

@sachinB94
Copy link

Hey, any update on this? I'm facing a similar issue with the react-native release build. Debug build works fine.
@tsdexter did you find anything?
using v7.1.2

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