This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
84 lines (78 loc) · 1.87 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"use strict";
/* global __dirname */
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const buildDir = "build/standalone/lib/";
const externals = {};
["jquery",
"bootstrap",
"log4javascript",
"font-awesome",
"xregexp",
"localforage",
"bootbox",
"typeahead",
"bloodhound",
"urijs",
"interactjs",
"merge-options",
"is-plain-obj",
"bluebird",
"last-resort",
"rangy",
"rangy-core",
"rangy-textrange",
"salve",
"salve-dom",
"bootstrap-notify",
"dexie",
"bluejax",
"bluejax.try",
"slug",
"ajv",
// onerror must be loadable outside wed...
"onerror",
// log is used by onerror
"log",
].forEach((name) => {
externals[name] = name;
});
module.exports = {
resolve: {
modules: [buildDir, "node_modules"],
},
entry: {
wed: "wed.js",
"wed.min": "wed.js",
},
externals,
devtool: "source-map",
output: {
path: `${__dirname}/build/packed/lib`,
filename: "[name].js",
sourceMapFilename: "[name].map.js",
library: "wed",
libraryTarget: "amd",
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
include: /\.min\.js$/,
}),
new CopyWebpackPlugin([
"wed/{glue,patches,polyfills,modes,savers}/**/*",
"{requirejs,external}/*", "{requirejs,external}/!(rxjs)/**/*",
"../kitchen-sink.html", "../requirejs-config.js", "kitchen-sink.js",
"../doc/**/*", "global-config.js", "json.js", "wed/**/*.css",
"wed/less-inc/**/*", "wed/{onerror,log,mode-map}.*"].map(name => ({
// Using an object with a "glob" field forces CopyWebpackPlugin to treat
// all patterns as globs and simplifies the logic a bit. Otherwise, we'd
// have to have a "to" field to switch where we put the results of some
// copies.
from: {
glob: name,
},
context: "./build/standalone/lib",
}))),
],
};