Skip to content

Commit cea5452

Browse files
committed
Intial commit
0 parents  commit cea5452

14 files changed

+26082
-0
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
presets: ["es2015", 'react', 'stage-0']
3+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
src
2+
demo
3+
.babelrc
4+
.gitignore
5+
webpack.config.babel.js
6+
webpack.config.production.babel.js

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# lazy-route - Lazy route loading for React Router 4 through System.import
2+
3+
#### Usage
4+
5+
This component only works with React Router 4 and it probably doesn't work correctly
6+
with Webpack 1, so use Webpack 2.
7+
8+
#### Usage
9+
10+
```javascript
11+
import {Match} from 'react-router'
12+
import LazyRoute from 'lazyroute'
13+
14+
<Match
15+
pattern="/myroute"
16+
render={(props) => <LazyRoute {...props} component={System.import('./myComponent')} />}
17+
/>
18+
```
19+
20+
#### NOT PRODUCTION READY
21+
The component works, but I have yet to add tests and some polish to it,
22+
the plan is to add a customizable loader etc.

demo/0.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
webpackJsonp([0],{
2+
3+
/***/ 96:
4+
/***/ function(module, exports, __webpack_require__) {
5+
6+
"use strict";
7+
8+
9+
Object.defineProperty(exports, "__esModule", {
10+
value: true
11+
});
12+
13+
var _react = __webpack_require__(6);
14+
15+
var _react2 = _interopRequireDefault(_react);
16+
17+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18+
19+
var testComponent = function testComponent() {
20+
return _react2.default.createElement(
21+
'div',
22+
null,
23+
'This is a test component'
24+
);
25+
};
26+
27+
exports.default = testComponent;
28+
29+
/***/ }
30+
31+
});

demo/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Lazy Route</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script src="main.js"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)