|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ |
| 4 | +/* eslint camelcase: 0 */ |
| 5 | + |
| 6 | +require('babel/register'); |
| 7 | + |
| 8 | +var path = require('path'); |
| 9 | +var webpack = require('webpack'); |
| 10 | + |
| 11 | +var writeStats = require('./utils/write-stats'); |
| 12 | + |
| 13 | +module.exports = { |
| 14 | + devtool: 'source-map', |
| 15 | + entry: { |
| 16 | + app: './app/index.js' |
| 17 | + }, |
| 18 | + output: { |
| 19 | + path: path.join(__dirname, '../dist/js'), |
| 20 | + filename: '[name]-[hash].js', |
| 21 | + publicPath: '/assets/js/' |
| 22 | + }, |
| 23 | + module: { |
| 24 | + preLoaders: [ |
| 25 | + { |
| 26 | + test: /\.js$|.jsx$/, |
| 27 | + exclude: /node_modules/, |
| 28 | + loaders: ['eslint-loader'] |
| 29 | + } |
| 30 | + ], |
| 31 | + loaders: [ |
| 32 | + { |
| 33 | + test: /\.js$|.jsx$/, |
| 34 | + exclude: /node_modules/, |
| 35 | + loaders: ['babel-loader'] |
| 36 | + } |
| 37 | + ] |
| 38 | + }, |
| 39 | + plugins: [ |
| 40 | + new webpack.DefinePlugin({ |
| 41 | + 'process.env': { |
| 42 | + BROWSER: JSON.stringify(true), |
| 43 | + NODE_ENV: JSON.stringify('production') |
| 44 | + } |
| 45 | + }), |
| 46 | + new webpack.optimize.DedupePlugin(), |
| 47 | + new webpack.optimize.OccurenceOrderPlugin(), |
| 48 | + new webpack.optimize.UglifyJsPlugin({ |
| 49 | + compress: { |
| 50 | + warnings: false, |
| 51 | + screw_ie8: true, |
| 52 | + sequences: true, |
| 53 | + dead_code: true, |
| 54 | + drop_debugger: true, |
| 55 | + comparisons: true, |
| 56 | + conditionals: true, |
| 57 | + evaluate: true, |
| 58 | + booleans: true, |
| 59 | + loops: true, |
| 60 | + unused: true, |
| 61 | + hoist_funs: true, |
| 62 | + if_return: true, |
| 63 | + join_vars: true, |
| 64 | + cascade: true, |
| 65 | + drop_console: true |
| 66 | + }, |
| 67 | + output: { |
| 68 | + comments: false |
| 69 | + } |
| 70 | + }), |
| 71 | + function () { this.plugin('done', writeStats); } |
| 72 | + ], |
| 73 | + resolve: { |
| 74 | + extensions: ['', '.js', '.json', '.jsx'], |
| 75 | + modulesDirectories: ['node_modules', 'app'] |
| 76 | + } |
| 77 | +}; |
0 commit comments