-
Notifications
You must be signed in to change notification settings - Fork 37
/
webpack.config.js
46 lines (40 loc) · 1.02 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
/* global __dirname, require, module*/
const webpack = require('webpack');
const path = require('path');
const { argv: args } = require('yargs');
const isProd = args.mode === 'production';
let plugins = [
new webpack.NamedModulesPlugin()
];
const libraryName = 'Terminal';
const config = {
entry: {
[libraryName]: [path.join(__dirname, 'src/index.js')]
},
devtool: 'source-map',
output: {
path: path.join(__dirname, 'lib'),
filename: isProd ? 'terminal.min.js' : 'terminal.js',
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true,
// Required to create single build for Node and web targets
// FIXME: https://github.com/webpack/webpack/issues/6522
globalObject: 'this'
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}]
},
resolve: {
modules: [path.resolve('./node_modules'), path.resolve('./src')],
extensions: ['.json', '.js']
},
plugins: plugins
};
module.exports = config;