Skip to content

Instantly share code, notes, and snippets.

@kristian76
Created March 22, 2016 14:43
Show Gist options
  • Save kristian76/e43d20fc22340e073a7b to your computer and use it in GitHub Desktop.
Save kristian76/e43d20fc22340e073a7b to your computer and use it in GitHub Desktop.
React setup with Babel, Webpack and fetch run npm install to have it up and running. Run npm install serve to get a dev server for assets
{
"name": "reactworkbench",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cd public && serve"
},
"author": "",
"license": "ISC",
"dependencies": {
"fetch": "^1.0.1",
"react": "^0.14.7",
"react-dom": "^0.14.7"
},
"devDependencies": {
"babel-core": "^6.5.2",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0"
}
}
/**
* Can be used to run multiple projects, each project is added to entry: and will generate a js bundle in eg
* '/public/js/awesomeapp/bundle.js', you can add entry: { hellokitty: './src/pussy.js' } which then creates
* a folder inside the output directory called public/js/hellokitty/bundle.js
*/
module.exports = {
entry: {
awesomeapp: './src/awesomeapp.js'
},
output: {
path: __dirname, filename: '/public/js/[name]/bundle.js'
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment