-
Notifications
You must be signed in to change notification settings - Fork 3
/
craco.config.js
46 lines (44 loc) · 1.17 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
// Allows configuration of create-react-app build process.
// ref: https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md
/* eslint-disable */
const fs = require('fs');
const cracoEnvPlugin = require('craco-plugin-env');
module.exports = {
eslint: {
enable: true,
mode: 'file',
configure: (eslintConfig) => {
eslintConfig.entry = './.eslintrc.js';
return eslintConfig;
},
},
style: {
postcss: {
plugins: [
require('autoprefixer'),
require('postcss-import'),
],
},
modules: {
localIdentName: '[path][name]__[local]--[hash:base64:5]'
}
},
plugins: [
{
plugin: cracoEnvPlugin,
options: {
variables: {
BUILD_VERSION: fs.existsSync('.git') ? require('child_process')
.execSync('git rev-parse HEAD', { cwd: __dirname })
.toString().trim() : 'DEV',
BUILD_DATE: fs.existsSync('.git') ? require('child_process')
.execSync('git show -s --format=%ci', { cwd: __dirname })
.toString().trim() : new Date().toLocaleDateString(),
},
},
},
],
typescript: {
enableTypeChecking: true,
},
};