PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.1.4
Plugin Detective – Troubleshooting Conflicts v1.1.4
1.2.35 1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 All 54 releases
plugin-detective / troubleshoot / app / build / webpack.prod.conf.js

webpack.prod.conf.js in Plugin Detective – Troubleshooting Conflicts 1.1.4, at troubleshoot/app/build/webpack.prod.conf.js

123 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var path = require('path')
2 var utils = require('./utils')
3 var webpack = require('webpack')
4 var config = require('../config')
5 var merge = require('webpack-merge')
6 var baseWebpackConfig = require('./webpack.base.conf')
7 var CopyWebpackPlugin = require('copy-webpack-plugin')
8 var HtmlWebpackPlugin = require('html-webpack-plugin')
9 var ExtractTextPlugin = require('extract-text-webpack-plugin')
10 var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
11
12 var env = config.build.env
13
14 var webpackConfig = merge(baseWebpackConfig, {
15 module: {
16 rules: utils.styleLoaders({
17 sourceMap: config.build.productionSourceMap,
18 extract: true
19 })
20 },
21 devtool: config.build.productionSourceMap ? '#source-map' : false,
22 output: {
23 path: config.build.assetsRoot,
24 filename: utils.assetsPath('js/[name].js'),
25 chunkFilename: utils.assetsPath('js/[id].js')
26 },
27 plugins: [
28 // http://vuejs.github.io/vue-loader/en/workflow/production.html
29 new webpack.DefinePlugin({
30 'process.env': env
31 }),
32 new webpack.optimize.UglifyJsPlugin({
33 compress: {
34 warnings: false
35 },
36 sourceMap: true
37 }),
38 // extract css into its own file
39 new ExtractTextPlugin({
40 filename: utils.assetsPath('css/[name].css')
41 }),
42 // Compress extracted CSS. We are using this plugin so that possible
43 // duplicated CSS from different components can be deduped.
44 new OptimizeCSSPlugin({
45 cssProcessorOptions: {
46 safe: true
47 }
48 }),
49 // generate dist index.html with correct asset hash for caching.
50 // you can customize output by editing /index.html
51 // see https://github.com/ampedandwired/html-webpack-plugin
52 new HtmlWebpackPlugin({
53 filename: config.build.index,
54 template: 'index.html',
55 inject: true,
56 minify: {
57 removeComments: true,
58 collapseWhitespace: true,
59 removeAttributeQuotes: true
60 // more options:
61 // https://github.com/kangax/html-minifier#options-quick-reference
62 },
63 // necessary to consistently work with multiple chunks via CommonsChunkPlugin
64 chunksSortMode: 'dependency'
65 }),
66 // keep module.id stable when vender modules does not change
67 new webpack.HashedModuleIdsPlugin(),
68 // split vendor js into its own file
69 new webpack.optimize.CommonsChunkPlugin({
70 name: 'vendor',
71 minChunks: function (module, count) {
72 // any required modules inside node_modules are extracted to vendor
73 return (
74 module.resource &&
75 /\.js$/.test(module.resource) &&
76 module.resource.indexOf(
77 path.join(__dirname, '../node_modules')
78 ) === 0
79 )
80 }
81 }),
82 // extract webpack runtime and module manifest to its own file in order to
83 // prevent vendor hash from being updated whenever app bundle is updated
84 new webpack.optimize.CommonsChunkPlugin({
85 name: 'manifest',
86 chunks: ['vendor']
87 }),
88 // copy custom static assets
89 new CopyWebpackPlugin([
90 {
91 from: path.resolve(__dirname, '../static'),
92 to: config.build.assetsSubDirectory,
93 ignore: ['.*']
94 }
95 ])
96 ]
97 })
98
99 if (config.build.productionGzip) {
100 var CompressionWebpackPlugin = require('compression-webpack-plugin')
101
102 webpackConfig.plugins.push(
103 new CompressionWebpackPlugin({
104 asset: '[path].gz[query]',
105 algorithm: 'gzip',
106 test: new RegExp(
107 '\\.(' +
108 config.build.productionGzipExtensions.join('|') +
109 ')$'
110 ),
111 threshold: 10240,
112 minRatio: 0.8
113 })
114 )
115 }
116
117 if (config.build.bundleAnalyzerReport) {
118 var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
119 webpackConfig.plugins.push(new BundleAnalyzerPlugin())
120 }
121
122 module.exports = webpackConfig
123