Authored by 陈峰

mini

1 { 1 {
2 - "presets": ["es2015","stage-0"], 2 + "presets": ["es2015", "stage-0"],
3 "plugins": [ 3 "plugins": [
4 "transform-runtime", 4 "transform-runtime",
5 "syntax-dynamic-import" 5 "syntax-dynamic-import"
This diff could not be displayed because it is too large.
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 ], 8 ],
9 "main": "build/sdk.js", 9 "main": "build/sdk.js",
10 "scripts": { 10 "scripts": {
11 - "build": "webpack --mode development --config ./webpack.config.babel.js ", 11 + "build": "webpack --mode production --config ./webpack.config.js ",
12 "lint-js": "lint-js" 12 "lint-js": "lint-js"
13 }, 13 },
14 "config": { 14 "config": {
@@ -32,27 +32,28 @@ @@ -32,27 +32,28 @@
32 "babel-core": "^6.26.0", 32 "babel-core": "^6.26.0",
33 "babel-loader": "^7.1.4", 33 "babel-loader": "^7.1.4",
34 "babel-plugin-import": "^1.7.0", 34 "babel-plugin-import": "^1.7.0",
35 - "babel-plugin-transform-runtime": "^6.23.0",  
36 "babel-plugin-syntax-dynamic-import": "^6.18.0", 35 "babel-plugin-syntax-dynamic-import": "^6.18.0",
  36 + "babel-plugin-transform-runtime": "^6.23.0",
37 "babel-preset-env": "^1.6.1", 37 "babel-preset-env": "^1.6.1",
38 "babel-preset-es2015": "^6.24.1", 38 "babel-preset-es2015": "^6.24.1",
39 "babel-preset-stage-0": "^6.24.1", 39 "babel-preset-stage-0": "^6.24.1",
40 "clean-webpack-plugin": "^0.1.19", 40 "clean-webpack-plugin": "^0.1.19",
41 "compression-webpack-plugin": "^1.1.11", 41 "compression-webpack-plugin": "^1.1.11",
42 "copy-webpack-plugin": "^4.5.1", 42 "copy-webpack-plugin": "^4.5.1",
43 - "extract-text-webpack-plugin": "^4.0.0-beta.0",  
44 - "uglifyjs-webpack-plugin": "^2.0.1",  
45 - "file-loader": "^1.1.11",  
46 - "url-loader": "^1.0.1",  
47 - "webpack": "^4.17.2",  
48 - "webpack-cli": "^2.0.14",  
49 - "weixin-js-sdk": "^1.3.3",  
50 - "fetch-jsonp": "^1.1.3",  
51 "eslint": "^3.19.0", 43 "eslint": "^3.19.0",
52 "eslint-config-yoho": "^1.0.1", 44 "eslint-config-yoho": "^1.0.1",
53 "eslint-loader": "^1.7.1", 45 "eslint-loader": "^1.7.1",
54 "eslint-plugin-html": "^2.0.3", 46 "eslint-plugin-html": "^2.0.3",
55 - "promise-polyfill": "^8.1.0" 47 + "extract-text-webpack-plugin": "^4.0.0-beta.0",
  48 + "fetch-jsonp": "^1.1.3",
  49 + "file-loader": "^1.1.11",
  50 + "promise-polyfill": "^8.1.0",
  51 + "uglifyjs-webpack-plugin": "^2.0.1",
  52 + "url-loader": "^1.0.1",
  53 + "webpack": "^4.17.2",
  54 + "webpack-bundle-analyzer": "^3.0.3",
  55 + "webpack-cli": "^3.1.2",
  56 + "weixin-js-sdk": "^1.3.3"
56 }, 57 },
57 "dependencies": {}, 58 "dependencies": {},
58 "directories": { 59 "directories": {
1 -import wx from 'weixin-js-sdk';  
2 import {linkToMiniApp, invokeMethod, createLinkButton} from "../utils/common"; 1 import {linkToMiniApp, invokeMethod, createLinkButton} from "../utils/common";
3 2
4 export default class { 3 export default class {
1 -import wx from 'weixin-js-sdk';  
2 import {createLinkButton} from "../utils/common"; 1 import {createLinkButton} from "../utils/common";
3 import base from './base'; 2 import base from './base';
4 3
1 //初始化config信息 1 //初始化config信息
2 import httpServer from '../utils/jsonp'; 2 import httpServer from '../utils/jsonp';
3 -import wx from "weixin-js-sdk";  
4 3
5 const _weChatInterface = '//action.yoho.cn/api/share/getSignPackage';//签名等相关配置,yoho公众号 4 const _weChatInterface = '//action.yoho.cn/api/share/getSignPackage';//签名等相关配置,yoho公众号
6 export default class { 5 export default class {
1 -import wx from "weixin-js-sdk";  
2 -  
3 const invokeMethod = (obj) => { 1 const invokeMethod = (obj) => {
4 if (window.yohoInterface) { 2 if (window.yohoInterface) {
5 window.yohoInterface.triggerEvent(obj.success || function () { 3 window.yohoInterface.triggerEvent(obj.success || function () {
1 -import webpack,{DefinePlugin} from 'webpack';  
2 -import path from 'path';  
3 -import CleanWebpackPlugin from 'clean-webpack-plugin'; 1 +const path = require('path');
  2 +const CleanWebpackPlugin = require('clean-webpack-plugin');
4 const uglify = require('uglifyjs-webpack-plugin'); 3 const uglify = require('uglifyjs-webpack-plugin');
  4 +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
5 5
6 let pathsToClean = [ 6 let pathsToClean = [
7 'build' 7 'build'
@@ -13,6 +13,7 @@ let cleanOptions = { @@ -13,6 +13,7 @@ let cleanOptions = {
13 }; 13 };
14 module.exports = { 14 module.exports = {
15 //项目入口js文件 15 //项目入口js文件
  16 + mode: 'production',
16 entry: ['./src/index.js'], 17 entry: ['./src/index.js'],
17 //项目输出目录 18 //项目输出目录
18 output: { 19 output: {
@@ -25,7 +26,8 @@ module.exports = { @@ -25,7 +26,8 @@ module.exports = {
25 //插件 26 //插件
26 plugins: [ 27 plugins: [
27 new CleanWebpackPlugin(pathsToClean, cleanOptions),//清除历史版本 28 new CleanWebpackPlugin(pathsToClean, cleanOptions),//清除历史版本
28 - new uglify({test: /\.js($|\?)/i,parallel: false}) 29 + // new BundleAnalyzerPlugin()
  30 + // new uglify({test: /\.js($|\?)/i,parallel: false})
29 ], 31 ],
30 //加载器 32 //加载器
31 module: { 33 module: {
@@ -41,7 +43,7 @@ module.exports = { @@ -41,7 +43,7 @@ module.exports = {
41 } 43 }
42 ] 44 ]
43 }, 45 },
44 - devtool: "inline-source-map", 46 + // devtool: "inline-source-map",
45 //模块路径 47 //模块路径
46 resolve:{ 48 resolve:{
47 alias: { 49 alias: {
This diff could not be displayed because it is too large.