-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
83 lines (79 loc) · 2.16 KB
/
webpack.config.js
File metadata and controls
83 lines (79 loc) · 2.16 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const path = require('path');
const webpack = require('webpack');
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const config = {
output: {
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
splitChunks: {
chunks: 'async',
},
usedExports: true,
concatenateModules: true,
mergeDuplicateChunks: true,
removeAvailableModules: true,
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
components: path.resolve(__dirname, '..', './src/components'),
common: path.resolve(__dirname, '..', './src/common'),
models: path.resolve(__dirname, '..', './src/models'),
pages: path.resolve(__dirname, '..', './src/pages'),
hooks: path.resolve(__dirname, '..', './src/hooks'),
},
},
devtool: 'source-map',
mode: 'production',
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
{
loader: 'file-loader',
},
],
},
{
test: /\.(ts|js)x?$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
},
},
],
},
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /\.(png|jpe?g|gif|svg)$/i,
}),
new SentryWebpackPlugin({
// sentry-cli configuration
// authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
release: "sergio-react@23.2.2",
// webpack specific configuration
include: path.resolve(__dirname, './dist'),
ignore: ['node_modules', 'webpack.config.js', 'webpack'],
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
DEV_USER_ID: JSON.stringify(process.env.DEV_USER_ID),
APP_HOST: JSON.stringify(process.env.APP_HOST),
APP_PORT: JSON.stringify(process.env.APP_PORT),
AUTH_CLIENT_ID: JSON.stringify(process.env.AUTH_CLIENT_ID),
},
}),
],
};
module.exports = config;