Created
June 21, 2016 16:27
-
-
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
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 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