Authored by 沈志敏

webpack2

1 { 1 {
2 - "presets": ["es2015"],  
3 - "plugins": ["transform-runtime"],  
4 - "comments": false 2 + "presets": [
  3 + ["env", {
  4 + "targets": {
  5 + "browsers": ["> 1%"]
  6 + }
  7 + }]
  8 + ]
5 } 9 }
1 'use strict'; 1 'use strict';
2 2
3 const fs = require('fs'); 3 const fs = require('fs');
4 -let devHost = 'm.yohobuy.com'; 4 +let devHost = '127.0.0.1';
5 5
6 fs.readFile('.devhost', (err, buf)=> { 6 fs.readFile('.devhost', (err, buf)=> {
7 if (!err) { 7 if (!err) {
@@ -42,16 +42,16 @@ @@ -42,16 +42,16 @@
42 42
43 {{#if devEnv}} 43 {{#if devEnv}}
44 {{#if localCss}} 44 {{#if localCss}}
45 - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/bundle/common.css"> 45 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css">
46 {{/if}} 46 {{/if}}
47 47
48 {{#if isFeature}} 48 {{#if isFeature}}
49 - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/bundle/feature.css"> 49 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/feature.css">
50 {{else}} 50 {{else}}
51 {{#ifor localCss vue}} 51 {{#ifor localCss vue}}
52 - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/bundle/{{module}}.{{page}}.css"> 52 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css">
53 {{^}} 53 {{^}}
54 - <link rel="stylesheet" media="all" href="//{{devHost}}:5001/bundle/index.css"> 54 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/index.css">
55 {{/ifor}} 55 {{/ifor}}
56 {{/if}} 56 {{/if}}
57 {{^}} 57 {{^}}
@@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
10 "scripts": { 10 "scripts": {
11 "start": "node app.js", 11 "start": "node app.js",
12 "dev": "nodemon -e js,hbs -i public/ app.js", 12 "dev": "nodemon -e js,hbs -i public/ app.js",
  13 + "static": "webpack-dev-server --config ./public/build/webpack.dev.config.js",
  14 + "build": "webpack --config ./public/build/webpack.base.config.js",
13 "online": "NODE_ENV=\"production\" node app.js", 15 "online": "NODE_ENV=\"production\" node app.js",
14 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js", 16 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
15 "lint-js": "eslint -c .eslintrc --cache .", 17 "lint-js": "eslint -c .eslintrc --cache .",
@@ -54,16 +56,14 @@ @@ -54,16 +56,14 @@
54 }, 56 },
55 "devDependencies": { 57 "devDependencies": {
56 "autoprefixer": "^6.7.4", 58 "autoprefixer": "^6.7.4",
57 - "babel-core": "^6.23.1",  
58 - "babel-loader": "^6.3.2",  
59 - "babel-plugin-transform-runtime": "^6.23.0",  
60 - "babel-preset-es2015": "^6.22.0",  
61 - "babel-runtime": "^6.23.0", 59 + "babel-core": "^6.24.0",
  60 + "babel-loader": "^6.4.1",
  61 + "babel-preset-env": "^1.2.2",
62 "css-loader": "^0.26.1", 62 "css-loader": "^0.26.1",
63 "eslint": "^3.16.0", 63 "eslint": "^3.16.0",
64 "eslint-config-yoho": "^1.0.1", 64 "eslint-config-yoho": "^1.0.1",
65 "eslint-plugin-html": "^2.0.1", 65 "eslint-plugin-html": "^2.0.1",
66 - "extract-text-webpack-plugin": "^1.0.1", 66 + "extract-text-webpack-plugin": "^2.1.0",
67 "gulp": "^3.9.1", 67 "gulp": "^3.9.1",
68 "gulp-cssnano": "^2.1.2", 68 "gulp-cssnano": "^2.1.2",
69 "gulp-ftp": "^1.1.0", 69 "gulp-ftp": "^1.1.0",
@@ -89,15 +89,15 @@ @@ -89,15 +89,15 @@
89 "postcss-use": "^2.3.0", 89 "postcss-use": "^2.3.0",
90 "precss": "^1.4.0", 90 "precss": "^1.4.0",
91 "shelljs": "^0.7.6", 91 "shelljs": "^0.7.6",
  92 + "style-loader": "^0.15.0",
92 "stylelint": "^7.9.0", 93 "stylelint": "^7.9.0",
93 "stylelint-config-yoho": "^1.2.8", 94 "stylelint-config-yoho": "^1.2.8",
94 "stylelint-processor-html": "^1.0.0", 95 "stylelint-processor-html": "^1.0.0",
95 "vue": "^2.1.10", 96 "vue": "^2.1.10",
96 - "vue-loader": "^11.1.0", 97 + "vue-loader": "^11.1.4",
97 "vue-template-compiler": "^2.1.10", 98 "vue-template-compiler": "^2.1.10",
98 - "webpack": "^1.14.0",  
99 - "webpack-dev-server": "^1.16.2",  
100 - "webpack-uglify-parallel": "^0.1.3", 99 + "webpack": "^2.2.1",
  100 + "webpack-dev-server": "^2.4.2",
101 "yoho-cookie": "^1.2.0", 101 "yoho-cookie": "^1.2.0",
102 "yoho-fastclick": "^1.0.6", 102 "yoho-fastclick": "^1.0.6",
103 "yoho-hammer": "^2.0.7", 103 "yoho-hammer": "^2.0.7",