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

Importing any extra component causes "uhandled error event" #12

Open
mewa opened this issue Jan 31, 2017 · 8 comments
Open

Importing any extra component causes "uhandled error event" #12

mewa opened this issue Jan 31, 2017 · 8 comments

Comments

@mewa
Copy link

mewa commented Jan 31, 2017

Importing any component
import { AutoComplete } from 'react-mdl-extra';
from react-mdl-extra causes

events.js:141
      throw er; // Unhandled 'error' event
@HriBB
Copy link
Owner

HriBB commented Feb 6, 2017

What version are you using? Which bundler (webpack, rollup, ...)?

For me it works without problems. This is an example AutoComplete component for redux-forms

import React, { PropTypes } from 'react'

import { AutoComplete } from 'react-mdl-extra'

const renderAutoCompleteField = props => {
  const { children, input, meta: { touched, error }, ...other } = props
  const extra = {
    error: touched && error,
  }
  return (
    <AutoComplete floatingLabel {...input} {...other} {...extra}>
      {children}
    </AutoComplete>
  )
}

renderAutoCompleteField.propTypes = {
  dataIndex: PropTypes.string.isRequired,
  input: PropTypes.object.isRequired,
  items: PropTypes.array.isRequired,
  label: PropTypes.string.isRequired,
  meta: PropTypes.object.isRequired,
  valueIndex: PropTypes.string.isRequired,
}

export default renderAutoCompleteField

@ikovic
Copy link

ikovic commented Feb 9, 2017

Hi, I have the same problem. Here are the possibly relevant npm packages I am using:

If trying to bundle the source using Browserify, I get the following error:
Unhandled 'error' event
SyntaxError: Unexpected token

@HriBB
Copy link
Owner

HriBB commented Feb 9, 2017

Hmm ... can you please provide some more info? It's hard to tell what's going on ...

@ikovic
Copy link

ikovic commented Feb 9, 2017

I'm having trouble getting a more verbose error log from Gulp. This is my build task for JS files:

gulp.task('js', function () {
  browserify(paths.JS_MAIN)
    .transform(babelify, {presets: ["es2015", "react"]})
    .bundle()
    .pipe(source('bundle.js'))
    .pipe(gulp.dest(paths.JS_BUILD));
});

The error happens if I import any of the MDL extra components.
I'd like to help you with more info, but this is as far as it gets. If I manage to get a better error report, I'll post it.

@HriBB
Copy link
Owner

HriBB commented Feb 9, 2017

I don't use browserify, so I really have no idea what could the problem be. Maybe try to catch some errors in the build process? @mewa are you using browserify as well?

Could be that I'm bundling the package incorrectly.

@ikovic
Copy link

ikovic commented Feb 9, 2017

Hi, my colleague helped me with getting a more detailed error message from browserify, this is what we came up with:

ParseError
annotated: "/Users/engine/Projects/browserify-test/node_modules/react-mdl-extra/lib/Menu/Menu.css:1.mdl-portalmenu ParseError: Unexpected token"
column: 1
line: 1
message: "Unexpected token"

I don't know if that is going to help you, it's the best we could do for now.

@HriBB
Copy link
Owner

HriBB commented Feb 9, 2017

Thanks, will check it out soon. You are welcome to make a PR 😉

@mewa
Copy link
Author

mewa commented Feb 13, 2017

@HriBB Yes, I'm using browserify as well - sorry for not saying it upfront etc., but I'm swarmed with other stuff at the moment ;)

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

3 participants