ソースを参照

Improved load times by adding webpack minfication reducing bundle.js file size from 1.48mb to 933kb.

theflametrooper 8 年 前
コミット
17ce539c0e
2 ファイル変更19 行追加1 行削除
  1. 1 0
      frontend/package.json
  2. 18 1
      frontend/webpack.config.js

+ 1 - 0
frontend/package.json

@@ -28,6 +28,7 @@
     "vue-loader": "^8.5.2",
     "vue-style-loader": "^1.0.0",
     "whatwg-fetch": "^0.11.1",
+		"webpack": "^1.14.0",
     "webpack-dev-server": "^1.15.1"
   },
   "dependencies": {

+ 18 - 1
frontend/webpack.config.js

@@ -1,3 +1,5 @@
+const webpack = require('webpack');
+
 module.exports = {
 	entry: './main.js',
 	output: {
@@ -38,5 +40,20 @@ module.exports = {
 		presets: ['es2015'],
 		plugins: ['transform-runtime'],
 		comments: false
-	}
+	},
+	plugins: [
+		new webpack.optimize.UglifyJsPlugin({
+			compress: {
+				warnings: false,
+				booleans: false,
+				unused: false
+			}
+		}),
+		new webpack.optimize.DedupePlugin(),
+		new webpack.DefinePlugin({
+			'process.env': {
+				'NODE_ENV': JSON.stringify('production')
+			}
+		})
+	]
 };