-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.cjs
44 lines (40 loc) · 1.2 KB
/
webpack.config.cjs
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
const path = require('path');
const worklets = [
'src/worklet/realtime-pitch-shift-processor.ts',
'src/worklet/offline-pitch-shift-processor.ts',
'src/worker/pitch-shift.worker.ts',
]
const getFilename = (filepath) => path.parse(filepath).name
const bundle = (worklet) => {
return {
entry: path.resolve(__dirname, worklet),
context: path.resolve(__dirname, "."),
module: {
rules: [
{
test: /\.(js|jsx|tsx|ts)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(wasm)$/i,
type: "asset/inline",
}
],
},
resolve: {
extensions: ['.ts', '.js'],
},
performance: {
maxAssetSize: 900000,
maxEntrypointSize: 900000
},
target: "webworker",
output: {
filename: `${getFilename(worklet)}.js`,
path: path.resolve(__dirname, 'public'),
publicPath: '',
}
}
}
module.exports = worklets.map(worklet => bundle(worklet));