Created
August 9, 2015 09:58
-
-
Save pyadav/c64a8dd9ae9ab46fc779 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
| var webpack = require('webpack'); | |
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var path = require('path'); | |
| var folders = { | |
| APP: path.resolve(__dirname, '../app'), | |
| BUILD: path.resolve(__dirname, '../build'), | |
| BOWER: path.resolve(__dirname, '../bower_components'), | |
| NPM: path.resolve(__dirname, '../node_modules') | |
| }; | |
| var config = { | |
| entry: { | |
| app: [ | |
| 'webpack/hot/dev-server', | |
| "./js/app.js" | |
| ] | |
| }, | |
| debug: true, | |
| resolve: { | |
| extensions: ['', '.js', '.jsx', '.scss'], | |
| alias: { | |
| //'es6-promise': path.join(folders.NPM, 'es6-promise', 'es6-promise.js'), | |
| //'fetch': path.join(folders.NPM, 'whatwg-fetch', 'fetch.js'), | |
| } | |
| }, | |
| stats: { | |
| colors: true, | |
| reasons: true, | |
| }, | |
| output: { | |
| path: __dirname + '/build', | |
| publicPath: '/', | |
| filename: '[name].[hash].js', | |
| chunkFilename: '[id].[hash].js' | |
| }, | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.s?css$/, | |
| exclude: /node_modules/, | |
| loaders: [ | |
| 'style', | |
| 'css', | |
| 'autoprefixer?browsers=last 2 version', | |
| 'sass?' + ['outputStyle=nested'].join('&') | |
| ] | |
| }, | |
| { test: /\.jsx?$/, loaders: ['react-hot', 'babel'], exclude: /node_modules/ }, | |
| { test: /\.json$/, loader: 'json' }, | |
| ] | |
| }, | |
| plugins: [ | |
| new webpack.HotModuleReplacementPlugin(), | |
| new webpack.ProvidePlugin({ | |
| 'es6-promise': 'es6-promise', | |
| 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' | |
| }), | |
| //new webpack.optimize.CommonsChunkPlugin('app', null, false), | |
| new webpack.NoErrorsPlugin(), | |
| new HtmlWebpackPlugin({ | |
| template: path.resolve('./', 'index.html'), | |
| webpackDevServer: '/webpack-dev-server.js' | |
| }) | |
| ] | |
| }; | |
| module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment