-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathwebpack.config.js
More file actions
48 lines (44 loc) · 1.18 KB
/
webpack.config.js
File metadata and controls
48 lines (44 loc) · 1.18 KB
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
const { join } = require('path');
const { StatsWriterPlugin } = require('webpack-stats-plugin');
let config = {
entry: './lib/index',
mode: 'production',
output: {
filename: 'directlinespeech.production.min.js',
library: 'DirectLineSpeech',
libraryTarget: 'window'
},
plugins: [
new StatsWriterPlugin({
filename: 'stats.json',
transform: (_, opts) => JSON.stringify(opts.compiler.getStats().toJson({ chunkModules: true }), null, 2)
})
]
};
// VSTS always emits uppercase environment variables.
const node_env = process.env.node_env || process.env.NODE_ENV;
if (node_env !== 'production' && node_env !== 'test') {
config = {
...config,
devtool: 'eval-source-map',
mode: 'development',
module: {
...config.module,
rules: [
...((config.module || {}).rules || []),
{
enforce: 'pre',
include: [join(__dirname, './lib')],
test: /\.js$/,
use: ['source-map-loader']
}
]
},
output: {
...config.output,
devtoolNamespace: 'botframework-directlinespeech-sdk',
filename: 'directlinespeech.development.js'
}
};
}
module.exports = config;