forked from BgeeDB/bgee-unil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
42 lines (38 loc) · 1.03 KB
/
craco.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
const { loaderByName, addAfterLoader, removeLoaders } = require('@craco/craco');
const rawLoader = require('craco-raw-loader');
module.exports = {
reactScriptsVersion: 'react-scripts',
style: {
css: {
loaderOptions: () => ({ url: false }),
},
},
webpack: {
configure: (webpackConfig, { env }) => {
const isEnvDevelopment = env === 'development';
const isEnvProduction = env === 'production';
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
removeLoaders(webpackConfig, loaderByName('resolve-url-loader'));
const resolveUrlLoader = {
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
};
addAfterLoader(
webpackConfig,
loaderByName('postcss-loader'),
resolveUrlLoader
);
return webpackConfig;
},
},
plugins: [
{
plugin: rawLoader,
options: {
test: /\.md$/,
},
},
],
};