Created
January 17, 2017 20:01
-
-
Save moizhb/f873289671ec5277b9405d7f90fe0873 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
const path = require('path'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
devtool: 'cheap-module-eval-source-map', | |
entry: [ | |
'eventsource-polyfill', // necessary for hot reloading with IE | |
'webpack-hot-middleware/client', | |
'./src/index' | |
], | |
output: { | |
path: path.join(__dirname, 'dist'), | |
filename: 'bundle-[hash].js', | |
publicPath: '/' | |
}, | |
plugins: [ | |
/** | |
* This is where the magic happens! You need this to enable Hot Module Replacement! | |
*/ | |
new webpack.HotModuleReplacementPlugin(), | |
/** | |
* NoErrorsPlugin prevents your webpack CLI from exiting with an error code if | |
* there are errors during compiling - essentially, assets that include errors | |
* will not be emitted. If you want your webpack to 'fail', you need to check out | |
* the bail option. | |
*/ | |
new webpack.NoErrorsPlugin(), | |
/** | |
* This is a webpack plugin that simplifies creation of HTML files to serve your | |
* webpack bundles. This is especially useful for webpack bundles that | |
* include a hash in the filename which changes every compilation. | |
*/ | |
new HtmlWebpackPlugin({ | |
template: 'index.html', | |
title: 'Simple Redux Boilerplate', | |
inject: 'body' | |
}), | |
/** | |
* DefinePlugin allows us to define free variables, in any webpack build, you can | |
* use it to create separate builds with debug logging or adding global constants! | |
* Here, we use it to specify a development build. | |
*/ | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify('development') | |
}), | |
], | |
module: { | |
loaders: [ | |
{ | |
test: /\.js?/, | |
exclude: [/node_modules/, /styles/], | |
loaders: ['babel'], | |
include: path.join(__dirname, 'src') | |
}, | |
{ | |
test: /\.scss$/, | |
loader: 'style!css!sass?outputStyle=compressed' | |
} | |
] | |
}, | |
sassLoader: { | |
includePaths: [ | |
'./node_modules' | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment