-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.ts
45 lines (43 loc) · 1.49 KB
/
craco.config.ts
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
/* eslint-disable no-param-reassign */
import * as webpack from 'webpack'
import { CracoConfig } from '@craco/craco'
const cracoConfig: CracoConfig = {
webpack: {
plugins: {
add: [
new webpack.ProvidePlugin({
Buffer: [require.resolve('buffer/'), 'Buffer'],
// process: require.resolve('process/browser.js'),
}),
],
},
configure: (webpackConfig, { env, paths }) => {
webpackConfig.resolve = {
...(webpackConfig?.resolve ?? {}),
fallback: {
...(webpackConfig?.resolve?.fallback ?? {}),
assert: require.resolve('assert/'),
buffer: require.resolve('buffer/'),
crypto: require.resolve('crypto-browserify'),
events: require.resolve('events/'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
'process/browser': require.resolve('process/browser.js'),
stream: require.resolve('stream-browserify'),
'stream-http': require.resolve('stream-http'),
string_decoder: require.resolve('string_decoder/'),
url: require.resolve('url/'),
util: require.resolve('util/'),
tslib: require.resolve('tslib/'),
},
}
webpackConfig.ignoreWarnings = [/Failed to parse source map/]
webpackConfig.stats = {
errorDetails: true,
}
return webpackConfig
},
},
}
export default cracoConfig