Created
December 16, 2015 23:19
-
-
Save koriner/d3897e55425cc9a3d4e4 to your computer and use it in GitHub Desktop.
example webpack prod config
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 StatsPlugin = require('stats-webpack-plugin'); | |
| module.exports = { | |
| entry: [ | |
| path.join(__dirname, 'app/index.js') | |
| ], | |
| output: { | |
| path: path.join(__dirname, '/dist/'), | |
| filename: '[name]-[hash].min.js' | |
| }, | |
| plugins: [ | |
| new webpack.optimize.OccurenceOrderPlugin(), | |
| new HtmlWebpackPlugin({ | |
| template: 'app/index.tpl.html', | |
| inject: 'body', | |
| filename: 'index.html' | |
| }), | |
| new ExtractTextPlugin('[name]-[hash].min.css'), | |
| new webpack.optimize.UglifyJsPlugin({ | |
| compressor: { | |
| warnings: false, | |
| screw_ie8: true | |
| } | |
| }), | |
| new StatsPlugin('webpack.stats.json', { | |
| source: false, | |
| modules: false | |
| }), | |
| new webpack.DefinePlugin({ | |
| 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) | |
| }), | |
| new webpack.ProvidePlugin({ | |
| 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' | |
| }) | |
| ], | |
| module: { | |
| loaders: [{ | |
| test: /\.js?$/, | |
| exclude: /node_modules/, | |
| loader: 'babel?optional=es7.decorators' | |
| }, { | |
| test: /\.json?$/, | |
| loader: 'json' | |
| }, { | |
| test: /\.css$/, | |
| loader: ExtractTextPlugin.extract('style', 'css?modules&localIdentName=[name]---[local]---[hash:base64:5]!postcss') | |
| }] | |
| }, | |
| resolve: { | |
| extensions: ['', '.js', '.jsx'] | |
| }, | |
| postcss: [ | |
| require('autoprefixer') | |
| ] | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment