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

Module parse failed #2

Open
Sinozet opened this issue Jul 19, 2017 · 4 comments
Open

Module parse failed #2

Sinozet opened this issue Jul 19, 2017 · 4 comments

Comments

@Sinozet
Copy link

Sinozet commented Jul 19, 2017

Module parse failed: D:\Projects\Main\node_modules\react-resize-sensor\ResizeSensor.js Unexpected token (9:6)
You may need an appropriate loader to handle this file type.
| render: function () {
| return (
| <iframe ref="iframe" style={{
| height: '100%',
| width: '100%',

@Venryx
Copy link
Contributor

Venryx commented Feb 21, 2018

I get the same error.

The fix would most likely be as simple as replacing:

render: function () {
    return (
      <iframe ref="iframe" style={{
        height: '100%',
        width: '100%',
        border: 'none',
        background: 'transparent',
        position: 'absolute',
        zIndex: -1,
        top: 0,
        left: 0,
      }} />
    );
  },

With:

render: function () {
    return (
      React.createElement("iframe", {ref: "iframe", style: {
        height: '100%',
        width: '100%',
        border: 'none',
        background: 'transparent',
        position: 'absolute',
        zIndex: -1,
        top: 0,
        left: 0,
      }})
    );
  },

In fact -- I just tested it, and this does indeed fix it.

@Venryx
Copy link
Contributor

Venryx commented Jul 20, 2018

@jehoshua02 Could you implement the fix above into the repo source code, and publish a new version on npm?

I'm using this library in multiple projects, and it's a little distracting having to apply the fix above manually each time.

I can verify that the code above works the same as the old -- it just uses basic Javascript instead of JSX syntax, which lets it work in vanilla babel. (ie. without having to configure it to use special JSX parsing for the library)

PS. Oh also, check out my one-line-change pull request: #1

@jehoshua02
Copy link
Owner

@Sinozet @Venryx It's been so long I forgot about this project and these issues just get buried in my email 😃 😅. I don't even work at a React shop anymore. At the time, no one really cared what I was doing with responsive components and were already overwhelmed with learning React. Glad to see someone found this useful.

The best solution is probably to compile the component in the lib itself. Are you guys still using this package? Why are you using this package over other packages?

I'd be happy to merge a pull request. I'll look at the other one.

@jehoshua02
Copy link
Owner

@Sinozet @Venryx you might also be interested in this https://www.npmjs.com/package/react-breakpoints-mixin

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