-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
82 lines (78 loc) · 2.48 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
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
/* eslint-disable @typescript-eslint/no-var-requires */
/* global __dirname, process */
const path = require('path');
const webpack = require('webpack');
const isDev = process.env.NODE_ENV === 'development';
const {BugsnagBuildReporterPlugin} = require('webpack-bugsnag-plugins');
const PACKAGE = require('./package.json');
const CONFIG = require('./config.json');
const {version} = PACKAGE;
const {bugsnagApiKeyStaging, bugsnagApiKeyProduction} = CONFIG;
const bugsnagPlugin = [];
bugsnagApiKeyStaging && bugsnagPlugin.push(new BugsnagBuildReporterPlugin({apiKey: bugsnagApiKeyStaging, appVersion: version}));
bugsnagApiKeyProduction && bugsnagPlugin.push(new BugsnagBuildReporterPlugin({apiKey: bugsnagApiKeyProduction, appVersion: version}));
module.exports = {
entry: {
one_page: './src/themes/one-page/init.tsx',
buy_now: './src/themes/buy-now/init.tsx',
three_page: './src/themes/three-page/init.tsx',
app_version_check: './src/appVersionCheck.ts',
},
output: {
path: path.join(__dirname, '/build'),
filename: '[name].js',
},
devtool: 'source-map',
mode: process.env.NODE_ENV,
target: 'web',
resolve: {
alias: {
src: path.resolve(__dirname, 'src'),
public: path.resolve(__dirname, 'public'),
root: path.resolve(__dirname),
},
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
extensions: ['.tsx', '.ts', '.jsx', '.js']
},
devServer: {
static: './',
host: 'localhost',
allowedHosts: 'all',
},
module: {
rules: [
{
test: /\.(css|scss)$/,
use: [
{
loader: 'style-loader',
options: {injectType: 'singletonStyleTag'}
}, 'css-loader']
},
{
test: /\.(jpg|jpeg|png|gif|mp3|svg)$/,
use: ['file-loader']
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader'
}
]
}
]
},
plugins: [
...bugsnagPlugin,
new webpack.DefinePlugin({
VERSION: JSON.stringify(version),
}),
],
performance: {
hints: isDev ? false : 'warning',
maxEntrypointSize: 1048576,
maxAssetSize: 1048576
}
};