Przeglądaj źródła

Minify + add babel

Brendan Abolivier 7 lat temu
rodzic
commit
464660d541
Podpisane przez: Brendan Abolivier <contact@brendanabolivier.com> ID klucza GPG: 8EF1500759F70623
3 zmienionych plików z 82 dodań i 32 usunięć
  1. 32
    0
      package-lock.json
  2. 31
    30
      package.json
  3. 19
    2
      webpack.config.js

+ 32
- 0
package-lock.json Wyświetl plik

@@ -749,6 +749,38 @@
749 749
         "semver": "5.4.1"
750 750
       }
751 751
     },
752
+    "babel-preset-es2015": {
753
+      "version": "6.24.1",
754
+      "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
755
+      "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=",
756
+      "dev": true,
757
+      "requires": {
758
+        "babel-plugin-check-es2015-constants": "6.22.0",
759
+        "babel-plugin-transform-es2015-arrow-functions": "6.22.0",
760
+        "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
761
+        "babel-plugin-transform-es2015-block-scoping": "6.26.0",
762
+        "babel-plugin-transform-es2015-classes": "6.24.1",
763
+        "babel-plugin-transform-es2015-computed-properties": "6.24.1",
764
+        "babel-plugin-transform-es2015-destructuring": "6.23.0",
765
+        "babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
766
+        "babel-plugin-transform-es2015-for-of": "6.23.0",
767
+        "babel-plugin-transform-es2015-function-name": "6.24.1",
768
+        "babel-plugin-transform-es2015-literals": "6.22.0",
769
+        "babel-plugin-transform-es2015-modules-amd": "6.24.1",
770
+        "babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
771
+        "babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
772
+        "babel-plugin-transform-es2015-modules-umd": "6.24.1",
773
+        "babel-plugin-transform-es2015-object-super": "6.24.1",
774
+        "babel-plugin-transform-es2015-parameters": "6.24.1",
775
+        "babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
776
+        "babel-plugin-transform-es2015-spread": "6.22.0",
777
+        "babel-plugin-transform-es2015-sticky-regex": "6.24.1",
778
+        "babel-plugin-transform-es2015-template-literals": "6.22.0",
779
+        "babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
780
+        "babel-plugin-transform-es2015-unicode-regex": "6.24.1",
781
+        "babel-plugin-transform-regenerator": "6.26.0"
782
+      }
783
+    },
752 784
     "babel-preset-flow": {
753 785
       "version": "6.23.0",
754 786
       "resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz",

+ 31
- 30
package.json Wyświetl plik

@@ -1,32 +1,33 @@
1 1
 {
2
-  "name": "sparrow",
3
-  "version": "0.0.1",
4
-  "description": "Sparrow is a libre front-end forum software powered by the Matrix protocol and using a Matrix homeserver as its back-end",
5
-  "scripts": {
6
-    "test": "echo \"Error: no test specified\" && exit 1",
7
-    "build": "webpack"
8
-  },
9
-  "repository": {
10
-    "type": "git",
11
-    "url": "git+https://github.com/babolivier/sparrow.git"
12
-  },
13
-  "author": "Brendan Abolivier <sparrow@brendanabolivier.com>",
14
-  "license": "AGPL-3.0",
15
-  "bugs": {
16
-    "url": "https://github.com/babolivier/sparrow/issues"
17
-  },
18
-  "homepage": "https://github.com/babolivier/sparrow",
19
-  "devDependencies": {
20
-    "babel-core": "6.26.0",
21
-    "babel-loader": "7.1.2",
22
-    "babel-polyfill": "6.26.0",
23
-    "babel-preset-env": "1.6.0",
24
-    "babel-preset-flow": "6.23.0",
25
-    "flow-bin": "0.55.0",
26
-    "html-webpack-plugin": "^2.30.1",
27
-    "webpack": "3.6.0"
28
-  },
29
-  "dependencies": {
30
-    "matrix-js-sdk": "^0.8.4"
31
-  }
2
+	"name": "sparrow",
3
+	"version": "0.0.1",
4
+	"description": "Sparrow is a libre front-end forum software powered by the Matrix protocol and using a Matrix homeserver as its back-end",
5
+	"scripts": {
6
+		"test": "echo \"Error: no test specified\" && exit 1",
7
+		"build": "webpack"
8
+	},
9
+	"repository": {
10
+		"type": "git",
11
+		"url": "git+https://github.com/babolivier/sparrow.git"
12
+	},
13
+	"author": "Brendan Abolivier <sparrow@brendanabolivier.com>",
14
+	"license": "AGPL-3.0",
15
+	"bugs": {
16
+		"url": "https://github.com/babolivier/sparrow/issues"
17
+	},
18
+	"homepage": "https://github.com/babolivier/sparrow",
19
+	"devDependencies": {
20
+		"babel-core": "6.26.0",
21
+		"babel-loader": "7.1.2",
22
+		"babel-preset-env": "1.6.0",
23
+		"babel-preset-flow": "6.23.0",
24
+		"flow-bin": "0.55.0",
25
+		"html-webpack-plugin": "2.30.1",
26
+		"uglifyjs-webpack-plugin": "^0.4.6",
27
+		"webpack": "3.6.0"
28
+	},
29
+	"dependencies": {
30
+		"babel-polyfill": "6.26.0",
31
+		"matrix-js-sdk": "0.8.4"
32
+	}
32 33
 }

+ 19
- 2
webpack.config.js Wyświetl plik

@@ -1,13 +1,30 @@
1
-const path				= require('path');
1
+const path = require('path');
2
+const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
2 3
 const HtmlWebpackPlugin = require('html-webpack-plugin');
3 4
 
4 5
 module.exports = {
5
-	entry: './src/index.js',
6
+	entry: ['babel-polyfill', './src/index.js'],
7
+	devtool: 'source-map',
8
+	module: {
9
+		rules: [
10
+			{
11
+				test: /\.js$/,
12
+				exclude: /node_modules/,
13
+				use: {
14
+					loader: 'babel-loader',
15
+					options: {
16
+						presets: ['env', 'flow']
17
+					}
18
+				}
19
+			}
20
+		]
21
+	},
6 22
  	output: {
7 23
 		filename: 'sparrow.js',
8 24
 		path: path.resolve(__dirname, 'dist')
9 25
 	},
10 26
 	plugins: [
27
+		new UglifyJSPlugin(),
11 28
 		new HtmlWebpackPlugin({
12 29
 			template: './src/index.html'
13 30
 		})