-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebpack.config.js
38 lines (36 loc) · 1.41 KB
/
Webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const path = require("path");
const WebpackNodeExternals = require("webpack-node-externals");
class Configuration {
constructor( options = {} ) {
this.entry = "./exports.js";
this.target = "node";
this.externals = [WebpackNodeExternals()];
this.output = {
"path": path.resolve("./dist"),
"filename": options.filename || "browser.js",
"libraryTarget": "commonjs2"
};
const babelrc = {
"babelrc": false,
"presets": [
["env", { "modules": false, "targets": { "browsers": [ "> 1%", "last 2 versions", "iOS >= 7", "Android >= 4.1"] } }]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
"transform-decorators-legacy",
"transform-class-properties",
"transform-async-to-generator",
]
.concat(options.runtime || options.runtime === void 0 ? "transform-runtime" : [])
.concat(options.plugins || [])
};
const loader = { "test": /\.(js|es6)(\?.*)?$/i, "exclude": /node_modules/i, "loader": "babel-loader", "options": babelrc };
this.module = {};
this.module.loaders = [loader];
}
}
module.exports = [
new Configuration({ "filename": "browser.js" }),
new Configuration({ "filename": "wepy.js", "runtime": false })
];