forked from AxisCommunications/media-stream-library-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
52 lines (51 loc) · 1.37 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 webpack = require('webpack');
module.exports = {
target: 'web',
entry: './lib/index.browser.ts',
mode: 'production',
output: {
library: 'mediaStreamLibrary',
path: __dirname,
filename: 'dist/media-stream-library.min.js',
},
resolve: {
extensions: ['.ts', '.js'],
// These polyfills replace Node.js packages with browser alternatives
fallback: {
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
process: require.resolve('process/browser')
},
},
plugins: [
// Import things that are not explicitely imported, because they should
// be global, or are used by other modules and expected to exist.
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process', // Needed internally by stream-browserify
})
],
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
sourceType: 'unambiguous',
presets: [
['@babel/env', { useBuiltIns: 'usage', corejs: 3 }],
'@babel/typescript',
],
plugins: [
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
],
babelrc: false,
},
},
},
],
},
}