Created
May 8, 2017 16:15
-
-
Save JaySpears/5abdc2ed09c0e91cabc726c9a5c3f012 to your computer and use it in GitHub Desktop.
Webpack 2.0 Configuration with React Example
This file contains 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'); | |
var webpack = require('webpack'); | |
module.exports = { | |
entry: [ | |
'react-hot-loader/patch', | |
'webpack-dev-server/client?http://localhost:3000/', | |
'webpack/hot/only-dev-server', | |
path.resolve(__dirname, 'app/index') | |
], | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'build'), | |
publicPath: '/build/' | |
}, | |
devtool: 'inline-source-map', | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)?$/, | |
exclude: /(node_modules|bower_components)/, | |
use: [{ | |
loader: 'babel-loader', | |
options: { | |
presets: ['es2015', 'react'] | |
} | |
}], | |
}, | |
{ | |
test: /\.scss$/, | |
use: ['style-loader', 'css-loader', 'sass-loader'] | |
} | |
] | |
}, | |
resolve: { | |
extensions: ['.js', '.jsx'] | |
}, | |
plugins: [ | |
new webpack.NoEmitOnErrorsPlugin(), | |
new webpack.HotModuleReplacementPlugin() | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment