-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
67 lines (60 loc) · 1.41 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
const pkg = require('./package.json');
const comment = `/*! @${pkg.author}/${pkg.name} version:${pkg.version} repository:${pkg.repository.url} copyright:${pkg.author} licensed:${pkg.license} */`;
const env = process.env.NODE_ENV;
if(!env) process.exit(1);
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const webpackPlugEnv = new webpack.EnvironmentPlugin({
VERSION: pkg.version,
DEBUG: false
});
const config = {
mode: env,
target: ['web', 'es5'],
entry: {
'js-player-module-brightcove': './src/js-player-module-brightcove.ts',
},
output: {
path: `${__dirname}/dist`,
filename: '[name].js',
library: {
name: 'PLAYER_MODULE_BRIGHTCOVE',
type: 'umd',
export: 'PLAYER_MODULE_BRIGHTCOVE',
}
},
module: {
rules: [
{
test: /\.(js|ts)$/,
exclude: /node_modules/,
use: 'ts-loader',
},
],
},
resolve: {
extensions: [
'.ts', '.js',
]
},
plugins: [
webpackPlugEnv
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
output: {
preamble: comment,
comments: false,
},
compress: {
drop_console: false
}
},
}),
],
}
};
module.exports = config;