forked from GreenfireInc/gFireButton.transition
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcraco.config.js
More file actions
39 lines (34 loc) · 1.11 KB
/
craco.config.js
File metadata and controls
39 lines (34 loc) · 1.11 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
const webpack = require('webpack')
module.exports = {
webpack: {
configure: (webpackConfig) => {
// Remove any existing source-map-loader rules
webpackConfig.module.rules = webpackConfig.module.rules.filter(
rule => !rule.use?.some(use => use.loader === 'source-map-loader')
);
// Add our custom source-map-loader rule that excludes node_modules
webpackConfig.module.rules.push({
test: /\.(js|mjs|jsx|ts|tsx)$/,
enforce: 'pre',
use: ['source-map-loader'],
exclude: /node_modules/,
});
webpackConfig.resolve.fallback = {
...webpackConfig.resolve.fallback,
stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'),
buffer: require.resolve('buffer/'),
process: require.resolve('process/browser.js'),
fs: false,
}
webpackConfig.plugins = [
...webpackConfig.plugins,
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser.js',
}),
]
return webpackConfig
},
},
}