-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
66 lines (63 loc) · 1.36 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
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const path = require("path");
const fs = require("fs");
const nodeModules = {};
fs.readdirSync("node_modules")
.filter(function (x) {
return [".bin"].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = "commonjs " + mod;
});
const config = [
{
entry: {
app: [__dirname + "/src/app/index.ts"],
},
output: {
path: __dirname + "/generators/",
filename: "[name]/index.js",
libraryTarget: "umd",
},
externals: nodeModules,
devtool: "source-map",
mode: "production",
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {},
},
target: "node",
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: [/templates/],
use: [
{
loader: "ts-loader",
},
],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
{
from: "src/app/templates",
to: "app/templates",
info: { minimized: true },
},
],
}),
],
},
];
module.exports = config;