Skip to content

Commit 0f62c07

Browse files
committed
fixed problem with wrong requirejs-babel usage
1 parent 558c3a4 commit 0f62c07

File tree

5 files changed

+21
-60
lines changed

5 files changed

+21
-60
lines changed

README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,7 @@
11
# react-babel
22

3-
Testing [requirejs-babel](https://github.com/mikach/requirejs-babel).
4-
5-
The project uses two plugins for React & JSX
6-
7-
* [jsx_requirejs_plugin](https://github.com/philix/jsx-requirejs-plugin) - based on JSXTransformer
8-
* [requirejs-babel](https://github.com/mikach/requirejs-babel) - based on [Babel](http://babeljs.io/)
9-
10-
The fist one is working fine. The second one is not working. `require('es6!app/components/App')`
11-
is returning an empty object.
12-
13-
index.js:
14-
15-
```javascript
16-
define(function (require, exports, module) {
17-
var React = require('react');
18-
19-
var App = require('es6!app/components/App'); // this does not work!
20-
console.log('DEBUG App::',App);
21-
// => DEBUG App:: Object {}
22-
23-
//var App = require('jsx!app/components/App'); this is OK
24-
//console.log(React.createElement(App));
25-
// => ReactElement {type: function, key: null, ref: null, _owner: null, _context: Object…}
26-
27-
React.render(React.createElement(App), document.getElementById('app'));
28-
});
29-
```
30-
3+
Using [React](http://facebook.github.io/react/)
4+
with [Babel](https://babeljs.io/).
315

326
## Install
337

app/components/App.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/components/Hello.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react'
2+
3+
const Hello = React.createClass({
4+
render() {
5+
return (
6+
<section>
7+
Hello World!
8+
</section>
9+
)
10+
}
11+
});
12+
13+
export default Hello;

app/mount.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react'
2+
3+
import Hello from 'es6!./components/Hello'
4+
5+
React.render(React.createElement(Hello), document.getElementById('app'));

index.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
define(function (require, exports, module) {
2-
var React = require('react');
3-
4-
5-
var App = require('es6!app/components/App'); // this does not work!
6-
console.log('DEBUG App::',App);
7-
// => DEBUG App:: Object {}
8-
9-
//var App = require('jsx!app/components/App'); this is OK
10-
//console.log(React.createElement(App));
11-
// => ReactElement {type: function, key: null, ref: null, _owner: null, _context: Object…}
12-
13-
React.render(React.createElement(App), document.getElementById('app'));
14-
});
1+
require(['es6!./app/mount']);

0 commit comments

Comments
 (0)