-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
31 lines (28 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
const path = require('path');
const NODE_ENV = process.env.NODE_ENV || 'development';
const env = require('dotenv').config({ path: path.join(__dirname, `${NODE_ENV}.env`) });
const { DefinePlugin } = require('webpack');
const WorkersSentryWebpackPlugin = require('workers-sentry/webpack');
console.log(`Using ${NODE_ENV} environment for build...`);
module.exports = {
mode: 'none',
target: 'webworker',
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'worker.js',
},
plugins: [
// Expose our environment in the worker
new DefinePlugin(Object.entries(env.parsed).reduce((obj, [ key, val ]) => {
obj[`process.env.${key}`] = JSON.stringify(val);
return obj;
}, { 'process.env.NODE_ENV': JSON.stringify(NODE_ENV) })),
// Publish source maps to Sentry on each build
new WorkersSentryWebpackPlugin(
process.env.SENTRY_AUTH_TOKEN,
process.env.SENTRY_ORG,
process.env.SENTRY_PROJECT,
),
],
};