File tree Expand file tree Collapse file tree 11 files changed +232
-0
lines changed
Expand file tree Collapse file tree 11 files changed +232
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "stage" : 2 ,
3+ "env" : {
4+ "development" : {
5+ "plugins" : [" react-transform" ],
6+ "extra" : {
7+ "react-transform" : {
8+ "transforms" : [{
9+ "transform" : " react-transform-hmr" ,
10+ "imports" : [" react" ],
11+ "locals" : [" module" ]
12+ }, {
13+ "transform" : " react-transform-catch-errors" ,
14+ "imports" : [" react" , " redbox-react" ]
15+ }]
16+ }
17+ }
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ tmp /*
2+ public /*
Original file line number Diff line number Diff line change 1+ {
2+ "parser": "babel-eslint",
3+ "ecmaFeatures": {
4+ "blockBindings": true,
5+ "forOf": true,
6+ "arrowFunctions": true,
7+ "jsx": true,
8+ "modules": true,
9+ "classes": true
10+ },
11+ "extends": "airbnb",
12+ "rules": {
13+ "indent": [2, 2],
14+ "comma-dangle" : [0],
15+ "func-names": [0],
16+ "key-spacing": [2, { "align": "colon" }],
17+ },
18+ "env": {
19+ "browser": true,
20+ "node": true,
21+ "es6": true,
22+ "amd": true,
23+ "mocha": true
24+ },
25+ "plugins": [
26+ "react"
27+ ]
28+ }
Original file line number Diff line number Diff line change 1+ .DS_Store
2+ node_modules
3+ npm-debug.log
4+ dist
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import ReactDOM from 'react-dom' ;
3+ import { App } from '../containers/App.jsx' ;
4+
5+ ReactDOM . render ( < App /> , document . getElementById ( 'root' ) ) ;
Original file line number Diff line number Diff line change 1+ import React , { Component } from 'react' ;
2+
3+ export const NICE = 'pink' ;
4+ export const SUPER_NICE = 'darkred' ;
5+
6+ class Counter extends Component {
7+ constructor ( props ) {
8+ super ( props ) ;
9+ this . state = { counter : 0 } ;
10+ this . interval = setInterval ( ( ) => this . tick ( ) , 1000 ) ;
11+ }
12+
13+ componentWillUnmount ( ) {
14+ clearInterval ( this . interval ) ;
15+ }
16+
17+ tick ( ) {
18+ this . setState ( {
19+ counter : this . state . counter + this . props . increment
20+ } ) ;
21+ }
22+
23+ render ( ) {
24+ return (
25+ < h1 style = { { color : this . props . color } } >
26+ Counter ({ this . props . increment } ): { this . state . counter }
27+ </ h1 >
28+ ) ;
29+ }
30+ }
31+
32+ export const App = ( ) => {
33+ return (
34+ < div >
35+ < Counter increment = { 1 } color = { NICE } />
36+ < Counter increment = { 5 } color = { SUPER_NICE } />
37+ </ div >
38+ ) ;
39+ } ;
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+ const express = require ( 'express' ) ;
3+ const webpack = require ( 'webpack' ) ;
4+ const config = require ( './webpack.config.dev' ) ;
5+
6+ const app = express ( ) ;
7+ const compiler = webpack ( config ) ;
8+
9+ app . use ( require ( 'webpack-dev-middleware' ) ( compiler , {
10+ noInfo : true ,
11+ publicPath : config . output . publicPath
12+ } ) ) ;
13+
14+ app . use ( require ( 'webpack-hot-middleware' ) ( compiler ) ) ;
15+
16+ app . use ( express . static ( 'public' ) ) ;
17+
18+ app . get ( '/' , function ( req , res ) {
19+ res . sendFile ( path . join ( __dirname , 'public' , 'index.html' ) ) ;
20+ } ) ;
21+
22+ app . listen ( 3000 , 'localhost' , function ( err ) {
23+ if ( err ) {
24+ console . log ( err ) ;
25+ return ;
26+ }
27+
28+ console . log ( 'Listening at http://localhost:3000' ) ;
29+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " dx-react-webpack" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "build:webpack" : " NODE_ENV=production webpack --config webpack.config.prod.js" ,
8+ "build" : " npm run build:webpack" ,
9+ "start" : " node devServer.js" ,
10+ "lint" : " eslint . --ext .js --ext .jsx"
11+ },
12+ "author" : " Nicolas @elBurabure Fernandez" ,
13+ "license" : " MIT" ,
14+ "devDependencies" : {
15+ "babel-core" : " ^5.8.29" ,
16+ "babel-eslint" : " ^4.1.3" ,
17+ "babel-loader" : " ^5.3.2" ,
18+ "babel-plugin-react-transform" : " ^1.1.1" ,
19+ "eslint" : " ^1.7.3" ,
20+ "eslint-config-airbnb" : " ^0.1.0" ,
21+ "eslint-plugin-react" : " ^3.6.3" ,
22+ "express" : " ^4.13.3" ,
23+ "react-transform-catch-errors" : " ^1.0.0" ,
24+ "react-transform-hmr" : " ^1.0.0" ,
25+ "redbox-react" : " ^1.1.1" ,
26+ "webpack" : " ^1.12.2" ,
27+ "webpack-dev-middleware" : " ^1.2.0" ,
28+ "webpack-hot-middleware" : " ^2.4.1"
29+ },
30+ "dependencies" : {
31+ "react" : " ^0.14.0" ,
32+ "react-dom" : " ^0.14.0"
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html >
3+ < head >
4+ < title > React Boilerplate</ title >
5+ </ head >
6+ < body >
7+ < div id ="root ">
8+ </ div >
9+ < script src ="/js/bundle.js "> </ script >
10+ </ body >
11+ </ html >
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+ const webpack = require ( 'webpack' ) ;
3+
4+ module . exports = {
5+ devtool : 'cheap-module-eval-source-map' ,
6+ entry : [
7+ 'webpack-hot-middleware/client' ,
8+ './app/client/index.jsx'
9+ ] ,
10+ output : {
11+ path : path . join ( __dirname , 'public' ) ,
12+ filename : 'bundle.js' ,
13+ publicPath : '/js/'
14+ } ,
15+ plugins : [
16+ new webpack . HotModuleReplacementPlugin ( ) ,
17+ new webpack . NoErrorsPlugin ( )
18+ ] ,
19+ module : {
20+ loaders : [ {
21+ test : / \. j s x ? $ / ,
22+ loaders : [ 'babel' ] ,
23+ include : path . join ( __dirname , 'app' )
24+ } ]
25+ }
26+ } ;
You can’t perform that action at this time.
0 commit comments