Last active
December 8, 2016 22:32
-
-
Save frnsys/eac368c647028fcad4aca088483a4c31 to your computer and use it in GitHub Desktop.
react setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>hello</title> | |
</head> | |
<body> | |
<div id="root">Loading...</div> | |
<script src="bundle.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './css/index.sass'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
ReactDOM.render( | |
<div>hello</div>, | |
document.getElementById('root')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "_react", | |
"version": "0.0.0", | |
"main": "index.js", | |
"scripts": { | |
"start": "webpack-dev-server --colors ---progress --port 8081", | |
"build": "webpack --colors --progress", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"dependencies": { | |
"react": "^0.14.5", | |
"react-dom": "^0.14.5" | |
}, | |
"devDependencies": { | |
"autoprefixer-loader": "^3.2.0", | |
"babel-core": "^6.3.26", | |
"babel-loader": "^6.2.0", | |
"babel-preset-es2015": "^6.3.13", | |
"babel-preset-react": "^6.3.13", | |
"css-loader": "^0.23.1", | |
"node-sass": "^3.8.0", | |
"sass-loader": "^4.0.0", | |
"style-loader": "^0.13.1", | |
"webpack": "^1.13.1", | |
"webpack-dev-server": "^1.15.2" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
module.exports = { | |
entry: './index', | |
output: { | |
filename: 'bundle.js' | |
}, | |
devtool: 'source-map', | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
loader: 'babel-loader', | |
exclude: /(node_modules|bower_components)/, | |
query: { | |
presets: ['es2015', 'react'] | |
} | |
}, | |
{ | |
test: /\.sass$/, | |
loaders: [ | |
'style', | |
'css', | |
'autoprefixer?browsers=last 3 versions', | |
'sass?outputStyle=expanded' | |
] | |
}, | |
{ | |
test: /\.json$/, | |
loaders: ['json'] | |
} | |
] | |
}, | |
resolve: { | |
extensions: ['', '.js', '.sass'], | |
modulesDirectories: ['node_modules'], | |
alias: { | |
'src': path.resolve('./src'), | |
'components': path.resolve('./components'), | |
} | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment