Skip to content

Commit a00e26e

Browse files
binghaiwangPeterRao
authored andcommitted
feat: example with build in es6 (#363)
* feat: example with build in es6 * feat: add build example
1 parent 2086bd3 commit a00e26e

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

example/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// require("babel-polyfill")
33

44
var $ = require('jquery');
5+
//if use in react , you can use require('ali-oss/dist/aliyun-oss-sdk.js'), or see webpack.prod.js
56
var OSS = require('ali-oss');
67
var appServer = '/sts';
78
var bucket = '<bucket-name>';

example/webpack.prod.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var path = require('path');
2+
3+
module.exports = {
4+
target: 'web',
5+
entry: path.resolve(__dirname + "/index.js"),
6+
output: {
7+
path: path.resolve(__dirname + "/public"),
8+
filename: "index.js"
9+
},
10+
module: {
11+
rules: [
12+
{
13+
test: /\.js$/,
14+
exclude: /(node_modules|bower_components)/,
15+
use: {
16+
loader: 'babel-loader',
17+
options: {
18+
presets: ["babel-preset-es2015", {modules: false}] //fix uglifyjs not support es6
19+
}
20+
}
21+
}
22+
]
23+
},
24+
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@
8686
"thunk-mocha": "^1.0.3",
8787
"timemachine": "^0.3.0",
8888
"uglify-js": "^2.8.29",
89-
"watchify": "^3.9.0",
90-
"stream-http": "^2.8.0"
89+
"watchify": "^3.9.0"
9190
},
9291
"dependencies": {
9392
"address": "^1.0.0",
@@ -112,6 +111,7 @@
112111
"sdk-base": "^2.0.1",
113112
"urllib": "^2.17.1",
114113
"utility": "^1.8.0",
115-
"xml2js": "^0.4.16"
114+
"xml2js": "^0.4.16",
115+
"stream-http": "^2.8.0"
116116
}
117117
}

0 commit comments

Comments
 (0)