forked from jannis-baum/Vivify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
33 lines (30 loc) · 859 Bytes
/
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
import path from 'path';
import { fileURLToPath } from 'url';
import webpack from 'webpack';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const buildDir = path.resolve(__dirname, 'build');
if (!('VIV_VERSION' in process.env)) {
throw new Error('VIV_VERSION environment variable has to be set to build');
}
const version = process.env.VIV_VERSION;
export default {
mode: 'production',
entry: {
main: path.resolve(buildDir, 'dist', 'app.js'),
},
output: {
path: buildDir,
filename: 'bundle.js',
chunkFormat: 'module',
},
externals: {
'utf-8-validate': 'esm utf-8-validate',
bufferutil: 'esm bufferutil',
},
target: 'node',
plugins: [
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(version),
}),
],
};