Skip to content

Instantly share code, notes, and snippets.

@obihann
Created June 21, 2016 16:27
Show Gist options
  • Save obihann/5be4a80680ed4723a63f1ddecc5bf210 to your computer and use it in GitHub Desktop.
Save obihann/5be4a80680ed4723a63f1ddecc5bf210 to your computer and use it in GitHub Desktop.
Development ready webpack config for images, es2015/babel/react js/jsx, and sass/scss with watch and source maps
var autoprefixer = require('autoprefixer');
const webpack = require('webpack');
module.exports = {
watch: true,
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
{
test: /\.css$/,
loader: 'style!css?sourceMap!postcss-loader?sourceMap'
},
{
test: /\.scss$/,
loaders: ['style', 'css?sourceMap', 'sass?sourceMap']
},
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
},
postcss: [ autoprefixer({ browsers: ['last 2 versions'] }) ],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment