-
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathcraco.config.js
52 lines (49 loc) · 1.41 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
43
44
45
46
47
48
49
50
51
52
// Custom config on top of CRA see:
// https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md#configuration
const path = require("path")
const CopyWebpackPlugin = require("copy-webpack-plugin")
module.exports = ({ env }) => {
const isEnvDevelopment = env === "development"
return {
style: {
postcssOptions: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
webpack: {
configure: {
// To access source maps during development as an unpacked extension
// we need source maps to be inline, otherwise chrome will not load
// them corretly.
devtool: isEnvDevelopment ? "inline-source-map" : false,
resolve: {
extensions: [".ts", ".tsx", ".json"],
alias: {
"@": path.resolve("src"),
},
},
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: "public",
globOptions: {
ignore: ["**/index.html"],
},
},
],
}),
],
},
devServer: {
devMiddleware: {
// This aid in debugging the source maps during development.
// When loading an unpacked extension in chrome we can see the
// source files and easily debug without needing to rebuild the
// entire app.
writeToDisk: true,
},
},
}
}