-
Notifications
You must be signed in to change notification settings - Fork 31
/
webpack.config.js
33 lines (31 loc) · 1.34 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
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const ZipPlugin = require("zip-webpack-plugin");
const path = require("path");
const package = require("./package");
const widgetName = package.name;
const widgetNameContext = widgetName + "Context";
const widgetVersion = package.version;
module.exports = {
entry: {
[widgetName]: [ "core-js/es/promise", `./src/${widgetName}/widget/${widgetName}.js` ],
[widgetNameContext]: [ "core-js/es/promise", `./src/${widgetName}/widget/${widgetNameContext}.js` ],
},
output: {
path: path.resolve(__dirname, "dist/tmp/src"),
filename: `${widgetName}/widget/[name].js`,
chunkFilename: `${widgetName}/widget/${widgetName}[id].js`,
libraryTarget: "amd",
publicPath: "/widgets/"
},
devtool: false,
mode: "production",
externals: [ /^mxui\/|^mendix\/|^dojo\/|^dijit\// ],
plugins: [
new webpack.LoaderOptionsPlugin({ debug: true }),
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: "dist/tmp" }),
new CopyWebpackPlugin([ {context: "src", from: "**/*.xml", debug: true} ], { copyUnmodified: true }),
new ZipPlugin({ path: `../../${widgetVersion}`, filename: widgetName, extension: "mpk" })
]
};