-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack.worker.config.js
58 lines (57 loc) · 1.37 KB
/
webpack.worker.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
const WrapperPlugin = require('wrapper-webpack-plugin');
module.exports = {
plugins: [
new WrapperPlugin({
afterOptimizations: true,
test: /\.js$/,
header: `
(function OpusMediaWorkerUMD(root, factory) {
if (typeof WorkerGlobalScope !== 'undefined' &&
self instanceof WorkerGlobalScope) {
var initWorker = factory();
initWorker();
}
else if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["encoderWorker"] = factory();
else
root["encoderWorker"] = factory();
})(typeof OpusMediaRecorder !== 'undefined' ? OpusMediaRecorder : typeof self !== 'undefined' ? self : this, function() {
return function() {`,
footer: `}});`
})
],
entry: {
encoderWorker: './src/encoderWorker.js'
},
node: {
fs: 'empty'
},
mode: 'development',
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|jsx|mjs)$/,
exclude: [
/node_modules/,
/build/
],
use: 'eslint-loader'
},
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
};