-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
46 lines (39 loc) · 1.24 KB
/
webpack.production.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
'use strict';
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { EnvironmentPlugin } = require('webpack');
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const baseConfig = require('./webpack.base.config');
const prodConfig = Object.assign(baseConfig, {
mode: 'production',
devtool: 'source-map',
});
prodConfig.module.rules.unshift({
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 1 } },
],
});
prodConfig.plugins.push(
new MiniCssExtractPlugin({ filename: '[name].[contenthash].css' })
);
if (process.env.RELEASE_TAG) {
prodConfig.plugins.push(new EnvironmentPlugin(['RELEASE_TAG']));
}
if (process.env.SENTRY_AUTH_TOKEN && process.env.RELEASE_TAG) {
prodConfig.plugins.push(
new SentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
release: process.env.RELEASE_TAG,
org: 'ab-0v',
project: 'record-web',
include: ['./src', './dist'],
deploy: {
env: 'production',
name: `${process.env.RELEASE_TAG} automatic deployment`,
url: `https://github.com/generative-fm/record/actions/runs/${process.env.GITHUB_RUN_NUMBER}`,
},
})
);
}
module.exports = prodConfig;