forked from pnp/generator-teams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
101 lines (95 loc) · 2.56 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright (c) Wictor Wilén. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var path = require('path');
var fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
var config = [{
entry: {
app: [
__dirname + '/src/app/index.ts'
],
bot: [
__dirname + '/src/bot/index.ts'
],
tab: [
__dirname + '/src/tab/index.ts'
],
custombot: [
__dirname + '/src/custombot/index.ts'
],
connector: [
__dirname + '/src/connector/index.ts'
],
messageExtension: [
__dirname + '/src/messageExtension/index.ts'
],
localization: [
__dirname + '/src/localization/index.ts'
]
},
output: {
path: __dirname + '/generators/',
filename: '[name]/index.js',
libraryTarget: 'commonjs-module'
},
externals: nodeModules,
devtool: 'sourcemap',
mode: 'development',
resolve: {
extensions: [".ts", ".tsx", ".js"],
alias: {}
},
target: 'node',
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [{
test: /\.tsx?$/,
exclude: [/lib/, /dist/, /templates/, /temp-templates/],
use: [{
loader: "ts-loader"
}]
}]
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin([{
from: 'src/app/templates',
to: 'app/templates'
}]),
new CopyWebpackPlugin([{
from: 'src/tab/templates',
to: 'tab/templates'
}]),
new CopyWebpackPlugin([{
from: 'src/bot/templates',
to: 'bot/templates'
}]),
new CopyWebpackPlugin([{
from: 'src/custombot/templates',
to: 'custombot/templates'
}]),
new CopyWebpackPlugin([{
from: 'src/connector/templates',
to: 'connector/templates'
}]),
new CopyWebpackPlugin([{
from: 'src/messageExtension/templates',
to: 'messageExtension/templates'
}])
]
}];
module.exports = config;