-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-overrides.js
53 lines (47 loc) · 1.52 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
/* config-overrides.js */
const webpack = require('webpack');
// const paths = require('react-scripts-ts/config/paths')
module.exports = function override(config, env) {
//do stuff with the webpack config...]
config.module.rules.push({
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: true,
configFile: 'tsconfig.json',
},
})
config.resolve.extensions = [
'*', '.js', '.jsx', '.ts', '.tsx'
]
// config.module.rules.push({
// test: /\.(js|jsx)$/,
// include: paths.appSrc,
// loader: require.resolve('babel-loader'),
// options: {
// babelrc: false,
// presets: [require.resolve('babel-preset-react-app')],
// cacheDirectory: true,
// },
// })
config.resolve.fallback = {
url: require.resolve('url'),
fs: require.resolve('fs'),
assert: require.resolve('assert/'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
path: require.resolve("path-browserify")
};
config.plugins.push(
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
);
return config;
}