-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
35 lines (31 loc) · 927 Bytes
/
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
const { loaderByName, addAfterLoader, removeLoaders } = require("@craco/craco");
module.exports = {
reactScriptsVersion: "react-scripts",
style: {
css: {
loaderOptions: () => {
return { 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;
},
},
};