Forked from humaan/webpack-demo-03-webpack.config.js
Last active
January 18, 2016 01:38
-
-
Save danb-humaan/b78fd6d71b2c96b0e33c to your computer and use it in GitHub Desktop.
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
module.exports = { | |
entry: getEntrySources(['./src/js/entry.js']), | |
output: { | |
publicPath: 'http://localhost:8080/', | |
filename: 'build/bundle.js' | |
}, | |
devtool: 'eval', | |
module: { | |
preLoaders: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'source-map' | |
} | |
], | |
loaders: [ | |
{ | |
test: /\.scss$/, | |
include: /src/, | |
loaders: [ | |
'style', | |
'css', | |
'autoprefixer?browsers=last 3 versions', | |
'sass?outputStyle=expanded' | |
] | |
}, | |
{ | |
test: /\.(jpe?g|png|gif|svg)$/i, | |
loaders: [ | |
'url?limit=8192', | |
'img' | |
] | |
}, | |
{ | |
test: /\.jsx?$/, | |
exclude: /(node_modules|bower_components)/, | |
loaders: [ | |
'react-hot', | |
'babel?presets[]=stage-0,presets[]=react,presets[]=es2015' | |
] | |
} | |
] | |
} | |
}; | |
function getEntrySources(sources) { | |
if (process.env.NODE_ENV !== 'production') { | |
sources.push('webpack-dev-server/client?http://localhost:8080'); | |
sources.push('webpack/hot/only-dev-server'); | |
} | |
return sources; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment