Created
February 5, 2016 22:55
-
-
Save marr/6c471a5ba3cee9d01b6c to your computer and use it in GitHub Desktop.
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
'use strict'; | |
import webpack from 'webpack'; | |
import HtmlWebpackPlugin from 'html-webpack-plugin'; | |
import path from 'path' | |
const env = process.env['NODE_ENV'] || 'development' | |
const config = { | |
entry: [ | |
'./test.js', | |
], | |
devServer: { | |
inline: true, | |
stats: { | |
colors: true, | |
hash: false, | |
version: false, | |
chunks: false, | |
children: false, | |
}, | |
hot: true, | |
historyApiFallback: true, | |
port: 8080, | |
}, | |
devtool: 'source-map', | |
debug: true, | |
output: { | |
path: './dist', | |
filename: '/assets/js/[name].[hash].js', | |
chunkFilename: '[name].chunk.js' | |
}, | |
module: { | |
loaders: [ | |
{ test: /\.js$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ }, | |
{ test: /\.html$/, exclude: /index\.html/, loader: 'file?name=[name].[ext]' }, | |
{ test: /\.s?css$/, loaders: ['style','css','sass']} | |
], | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin(), | |
new webpack.optimize.DedupePlugin(), | |
new webpack.DefinePlugin({ | |
'__DEV__' : env === 'development', | |
'__PROD__' : env === 'production' | |
}), | |
new HtmlWebpackPlugin({ | |
template: 'index.html', // Load a custom template | |
inject: 'body', // Inject all scripts into the body | |
}), | |
new webpack.ProvidePlugin({ | |
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' | |
}) | |
], | |
node: { | |
fs: 'empty' | |
}, | |
resolve: { | |
root: [path.resolve('app')] | |
} | |
}; | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment