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

Breaks with jspm #38

Closed
togakangaroo opened this issue Dec 11, 2015 · 1 comment
Closed

Breaks with jspm #38

togakangaroo opened this issue Dec 11, 2015 · 1 comment

Comments

@togakangaroo
Copy link

this is due to the following bit of code in the (I assume transpiled) PageView.js

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

...

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

wheeelp _react is a perfectly proper module with a default on it. But it doesn't have __esModule because as far as I can tell this is non-standard. So this interop function actually ends up re-wrapping things and breaking interop!

@togakangaroo
Copy link
Author

I can get this working in the following hacky way.

Wire actual react to real-react

 jspm install real-react=react

Then create your own react.js at the route which redefines React along with any explicit exports and __esModule

import React from 'real-react'

export const Children = React.Children;
export const Component = React.Component;
export const createElement = React.createElement;
export const cloneElement = React.cloneElement;
export const isValidElement = React.isValidElement;
export const PropTypes = React.PropTypes;
export const createClass = React.createClass;
export const createFactory = React.createFactory;
export const createMixin = React.createMixin;
export const DOM = React.DOM;
export const version = React.version;
export const findDOMNode = React.findDOMNode;
export const render = React.render;
export const unmountComponentAtNode = React.unmountComponentAtNode;
export const renderToString = React.renderToString;
export const renderToStaticMarkup = React.renderToStaticMarkup;

export const __esModule = true
export default React

@AdeleD AdeleD closed this as completed Aug 4, 2018
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