Skip to content

Instantly share code, notes, and snippets.

@SPY
Last active August 29, 2015 14:14
Show Gist options
  • Save SPY/ac340d6d05c827f39bbc to your computer and use it in GitHub Desktop.
Save SPY/ac340d6d05c827f39bbc to your computer and use it in GitHub Desktop.
Minimal webpack for ReactJS with ES6
<!DOCTYPE html>
<html>
<head><title>Example</title></head>
<body>
<script type="text/javascript" src="http://localhost:8090/webpack-dev-server.js"></script>
<script type="text/javascript" src="http://localhost:8090/assets/bundle.js"></script>
</body>
</html>
{
"name": "materialui-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "npm run serve | npm run dev",
"serve": "./node_modules/.bin/http-server -p 8080",
"dev": "webpack-dev-server --progress --colors --port 8090"
},
"author": "",
"license": "ISC",
"dependencies": {
"material-ui": "^0.5.0",
"react": "^0.12.2",
"react-router": "^0.11.6",
"reflux": "^0.2.2"
},
"devDependencies": {
"6to5": "^2.7.1",
"6to5-loader": "^1.0.0",
"css-loader": "^0.9.0",
"file-loader": "^0.8.1",
"http-server": "^0.7.4",
"jsx-loader": "^0.12.2",
"less": "^2.2.0",
"less-loader": "^2.0.0",
"style-loader": "^0.8.2",
"url-loader": "^0.5.5",
"webpack": "^1.4.15",
"webpack-dev-server": "^1.7.0"
}
}
module.exports = {
entry: './src/index.jsx',
output: {
filename: 'bundle.js',
publicPath: 'http://localhost:8090/assets'
},
module: {
loaders: [
{
test: /src(?:.*)\.jsx$/,
loaders: [
'jsx-loader?insertPragma=React.DOM&harmony'
]
},
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&minetype=application/font-eot"
}
]
},
libs: [
'react',
'material-ui',
'react-router',
'reflux'
],
resolve: {
extensions: ['', '.js', '.jsx']
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment