-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-overrides.js
108 lines (106 loc) · 3.22 KB
/
config-overrides.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = function override(config, env) {
const fallback = config.resolve.fallback || {};
config.resolve.fallback = fallback;
config.ignoreWarnings = [/Failed to parse source map/];
return {
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.(ts|tsx)?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.svg$/,
loader: 'svg-inline-loader'
},
{
test: /\.(png|svg|jpg|jpeg|gif|ico)$/,
exclude: /node_modules/,
use: ['file-loader?name=[name].[ext]'] // ?name=[name].[ext] is only necessary to preserve the original file name
},
{
test: /\.json$/,
exclude: /node_modules/,
loader: 'json-loader'
},
{
test: /\.m?js/,
exclude: /node_modules/,
type: "javascript/auto",
},
],
},
mode: "production",
performance: {
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
stats: {
children: true,
errorDetails: true
},
entry: {
"app": "./src/index.js"
},
devtool: "source-map",
resolve: {
extensions: [".tsx", ".ts", ".js",".jsx",".json"],
fallback: {
'process/browser': require.resolve('process/browser'),
fs: false,
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"stream": require.resolve("stream-browserify"),
"buffer": require.resolve('buffer/'),
"crypto": require.resolve("crypto-browserify"),
"os": require.resolve("os-browserify/browser"),
"url": require.resolve("url"),
"assert": require.resolve("assert"),
},alias: {
process: "process/browser"
},
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build'),
},
plugins: [
new Dotenv({
systemvars: true, // load all the predefined 'process.env' variables which will trump anything local per dotenv specs.
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser'
}),
new HtmlWebpackPlugin({
template: './public/index.html',
filename: './index.html',
favicon: './public/favicon.ico'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV' : JSON.stringify('production')
}),
]
};
};