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

jquery plugin integration production build fails #1914

Closed
chandmk opened this issue Aug 25, 2017 · 2 comments
Closed

jquery plugin integration production build fails #1914

chandmk opened this issue Aug 25, 2017 · 2 comments

Comments

@chandmk
Copy link

chandmk commented Aug 25, 2017

I am trying to integrate a jquery mobile menu. Following code works fine in dev build. But fails with the error

Component code


import React, { Component } from "react";
import jQuery from "jquery";
import mmenu from "jquery.mmenu";

class MMenu extends Component {
  componentDidMount() {
    this.$el = jQuery(this.el);
    this.$el.mmenu({navbar: {add: false}});
  }

  componentWillUnmount() {
    this.$el.mmenu("destroy");
  }

  render() {
    return (
        <nav  id="menu" ref={el => (this.el = el)} >
          {this.props.children}
        </nav>        
    );
  }
}

export default MMenu;

Error while making production build

 Error: Cannot set property 'mmenu' of undefined

    - render-page.js:59764
      render-page.js:59764:11413

    - render-page.js:59764 Object.<anonymous>
      render-page.js:59764:12312

    - render-page.js:59745 n
      render-page.js:59745:231

    - render-page.js:59751 Object.exports.__esModule
      render-page.js:59751:3

    - render-page.js:30 __webpack_require__
      render-page.js:30:30

    - render-page.js:49404 Object.<anonymous>
      render-page.js:49404:17

    - render-page.js:30 __webpack_require__
      render-page.js:30:30

    - render-page.js:47481 Object.exports.__esModule
      render-page.js:47481:15

    - render-page.js:30 __webpack_require__
      render-page.js:30:30

    - render-page.js:47401 Object.exports.__esModule
      render-page.js:47401:19

@chandmk
Copy link
Author

chandmk commented Aug 26, 2017

I realized that I can load a dummy file while building for production

@chandmk chandmk closed this as completed Aug 26, 2017
@ovsw
Copy link

ovsw commented Jan 1, 2019

Can you please give more details on how you fixed the error? Trying to do the same thing but I don't understand what you mean by "load a dummy file while". Thanks!

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