Created
October 11, 2016 07:29
-
-
Save maryleloisa/69702b74f3112a0be01d29d407a359e3 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
| 'use strict'; | |
| var path = require('path'); | |
| var webpack = require('webpack'); | |
| var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
| var WriteFilePlugin = require('write-file-webpack-plugin'); | |
| const devServer = { | |
| contentBase: path.resolve(__dirname, './app'), | |
| outputPath: path.join(__dirname, './dist'), | |
| colors: true, | |
| quiet: false, | |
| noInfo: false, | |
| publicPath: '/', | |
| historyApiFallback: false, | |
| host: '127.0.0.1', | |
| proxy:{ | |
| '/graphql': { | |
| target: 'http://localhost:8080' | |
| } | |
| }, | |
| port: 3000, | |
| hot: true | |
| }; | |
| module.exports = { | |
| devtool: 'eval-source-map', | |
| debug: true, | |
| devServer: devServer, | |
| entry: [ | |
| 'webpack/hot/dev-server', | |
| 'webpack-hot-middleware/client?reload=true', | |
| path.join(__dirname, 'app/main.js') | |
| ], | |
| output: { | |
| path: path.join(__dirname, '/dist/'), | |
| filename: '[name].js', | |
| publicPath: devServer.publicPath | |
| }, | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.js?$/, | |
| loader: 'babel', | |
| exclude: /node_modules|lib/, | |
| }, | |
| { | |
| test: /\.json?$/, | |
| loader: 'json' | |
| }, | |
| { | |
| test: /\.css$/, | |
| loader: 'style!css?modules&localIdentName=[name]---[local]---[hash:base64:5]' | |
| }, | |
| { | |
| test: /\.scss$/, | |
| loaders: [ | |
| 'style?sourceMap', | |
| 'css?modules&importLoaders=1&localIdentName=[name]--[local]', | |
| 'sass?sourceMap' | |
| ], | |
| exclude: /node_modules|lib/ | |
| }, | |
| ], | |
| }, | |
| plugins: [ | |
| new WriteFilePlugin(), | |
| new ExtractTextPlugin('app.css', { | |
| allChunks: true | |
| }), | |
| new HtmlWebpackPlugin({ | |
| template: 'app/index.tpl.html', | |
| inject: 'body', | |
| filename: 'index.html' | |
| }), | |
| new webpack.optimize.OccurenceOrderPlugin(), | |
| new webpack.HotModuleReplacementPlugin(), | |
| new webpack.NoErrorsPlugin(), | |
| new webpack.DefinePlugin({ | |
| 'process.env.NODE_ENV': JSON.stringify('dev') | |
| }) | |
| ], | |
| node: { | |
| fs: 'empty' | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment