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

Bug issue with babel-plugin-transform-react-constant-elements #525

Closed
velopert opened this issue Aug 31, 2016 · 5 comments
Closed

Bug issue with babel-plugin-transform-react-constant-elements #525

velopert opened this issue Aug 31, 2016 · 5 comments

Comments

@velopert
Copy link

When I work on my React Project, I usually put the component files in a directory and create a index.js so that I can load the components like import { UserInfo, AnotherComponent } from 'container';

Today, I tried using that structure with create-react-app. It works perfectly on the dev-server, but it gives following error when I try to load the component:

React: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

My have uploaded the directory structure and codes on gist: https://gist.github.com/velopert/ab6e132d73a17930c90e3e38493c12ed

It seems like there's no problem if I import and render the components from outside of the directory.
(For example, I can import and render App component from src/index.js, if I do not render UserInfo from App component). I tried console.log() from App, and it seems like there is no problem with importing the module. I think there is an issue with rendering it.

Anyways, I just have found out that the babel-plugin-transform-react-constant-elements is the one that causes problem. I commented out the babel-plugin-transform-react-constant-elements part from the babel.prod.js and it works fine again.

Thanks !

@gaearon
Copy link
Contributor

gaearon commented Aug 31, 2016

This sounds bad. Can you search Babel Phabricator for relevant issues so we can track this? I would not be surprised if similar reports already exist.

@hzoo
Copy link

hzoo commented Sep 1, 2016

From babel/babel#3596 (comment): https://phabricator.babeljs.io/T7520 cc @kittens

Although there are a few of these: https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/#R

@gaearon
Copy link
Contributor

gaearon commented Sep 1, 2016

Okay I’m going to disable this transform because it’s buggy.
This is really unfortunate. 😢

gaearon added a commit that referenced this issue Sep 1, 2016
Disabled because of issues:
 * #525
 * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/

TODO: Enable again when these issues are resolved.
gaearon added a commit that referenced this issue Sep 1, 2016
Disabled because of issues:
 * #525
 * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/

TODO: Enable again when these issues are resolved.
@gaearon
Copy link
Contributor

gaearon commented Sep 2, 2016

Fixed for now in 0.3.0+ by disabling that plugin.

@gaearon gaearon closed this as completed Sep 2, 2016
stayradiated pushed a commit to stayradiated/create-react-app that referenced this issue Sep 7, 2016
@kaatt
Copy link

kaatt commented Sep 15, 2016

Also check: babel/babel#4516

feiqitian pushed a commit to feiqitian/create-react-app that referenced this issue Oct 25, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants