-
Notifications
You must be signed in to change notification settings - Fork 113
/
webpack.config.js
52 lines (45 loc) · 1.05 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
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
module.exports = (env = {}) => ({
entry: './src/index.ts',
mode: 'production',
module: {
rules: [
{
test: /(jsonwebtoken|batch_operations|redirect_url)/,
use: 'null-loader',
},
{
test: /\.(js|ts)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx|cjs)$/, /\.html$/, /\.json$/],
type: 'asset/resource',
},
],
},
resolve: {
extensions: ['.js', '.ts'],
},
optimization: {
minimize: !!env.minify,
},
output: {
path: env.minify ? path.join(__dirname, 'dist', 'js_min') : path.join(__dirname, 'dist', 'js'),
publicPath: 'dist/',
filename: 'getstream.js',
chunkFilename: '[chunkhash].js',
library: 'stream',
libraryTarget: 'umd',
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
PACKAGE_VERSION: JSON.stringify(pkg.version),
},
}),
],
});