Browse Source

add: webpack

shiqi.li 6 years ago
parent
commit
83c11c9638
2 changed files with 44 additions and 12 deletions
  1. 23 12
      package.json
  2. 21 0
      webpack.config.js

+ 23 - 12
package.json

@@ -3,8 +3,9 @@
   "version": "1.0.2",
   "version": "1.0.2",
   "description": "全景标记,全景生成插件",
   "description": "全景标记,全景生成插件",
   "scripts": {
   "scripts": {
-    "build": "babel ./src/tpanorama.js --out-file ./lib/tpanorama.js",
-    "start": "npm run build && node ./server/www"
+    "babel": "babel ./src/tpanorama.js --out-file ./lib/tpanorama.js",
+    "webpack": "webpack  --config webpack.config.js",
+    "start": "npm run webpack && node ./server/www"
   },
   },
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
@@ -24,16 +25,26 @@
     "express": "~4.16.0",
     "express": "~4.16.0",
     "handlebars": "^4.0.12",
     "handlebars": "^4.0.12",
     "http-errors": "~1.6.2",
     "http-errors": "~1.6.2",
-    "morgan": "~1.9.0"
+    "morgan": "~1.9.0",
+    "three": "^0.99.0"
   },
   },
   "devDependencies": {
   "devDependencies": {
-    "babel": "^6.23.0",
-    "babel-cli": "^6.26.0",
-    "babel-core": "^6.14.0",
-    "babel-eslint": "^10.0.1",
-    "babel-loader": "^6.2.5",
-    "babel-plugin-istanbul": "^2.0.1",
-    "babel-preset-es2015": "^6.14.0",
-    "babel-preset-stage-1": "^6.24.1"
+    "babel-core": "^6.26.3",
+    "babel-eslint": "^8.2.3",
+    "babel-jest": "^23.0.0",
+    "babel-loader": "^7.1.4",
+    "babel-plugin-add-module-exports": "^0.2.1",
+    "babel-plugin-dev-expression": "^0.2.1",
+    "babel-plugin-import": "^1.8.0",
+    "babel-plugin-transform-class-properties": "^6.24.1",
+    "babel-plugin-transform-decorators-legacy": "^1.3.5",
+    "babel-plugin-transform-es2015-classes": "^6.24.1",
+    "babel-plugin-transform-runtime": "^6.23.0",
+    "babel-preset-es2015": "^6.24.1",
+    "babel-preset-stage-0": "^6.24.1",
+    "babel-preset-stage-1": "^6.24.1",
+    "babel-register": "^6.26.0",
+    "webpack": "^4.27.1",
+    "webpack-cli": "^3.1.2"
   }
   }
-}
+}

+ 21 - 0
webpack.config.js

@@ -0,0 +1,21 @@
+var webpack = require('webpack');
+var path = require('path');
+
+module.exports = {
+  entry: __dirname + '/src/tpanorama.js',
+  output: {
+    path: __dirname + '/lib',
+    filename: 'tpanorama.js'
+  },
+  module: {
+    rules: [
+      {
+        test: /\.js$/,
+        exclude: /(node_modules|bower_components)/,
+        use: {
+          loader: 'babel-loader'
+        }
+      }
+    ]
+  },
+};