-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
73 lines (71 loc) · 2.76 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const path = require('path')
module.exports = {
webpack: {
alias: {
'@app': path.resolve(__dirname, 'src/app/'),
'@components': path.resolve(__dirname, 'src/components/'),
'@constants': path.resolve(__dirname, 'src/constants/'),
'@functions': path.resolve(__dirname, 'src/utils/functions/'),
'@generated': path.resolve(__dirname, 'src/features/generated/'),
'@hooks': path.resolve(__dirname, 'src/utils/hooks/'),
'@layouts': path.resolve(__dirname, 'src/layouts/'),
'@modules': path.resolve(__dirname, 'src/modules/'),
'@pages': path.resolve(__dirname, 'src/pages/'),
'@services': path.resolve(__dirname, 'src/features/services/'),
'@styles': path.resolve(__dirname, 'src/styles/'),
'@utility-components': path.resolve(__dirname, 'src/utils/components/'),
'@widgets': path.resolve(__dirname, 'src/features/widgets/'),
},
plugins: {
add: [],
remove: [],
},
// configure: (webpackConfig, { env }) => {
// if (env === 'development') {
// const publicPath = `//${process.env.HOST}:${process.env.PORT}/`
// console.log(publicPath)
// webpackConfig.output.publicPath = publicPath
// } else {
// const publicPath = `${process.env.REACT_APP_PUBLIC_PATH}`
// const path = `//${format(
// `${process.env.HOST}:${process.env.PORT}${publicPath}`
// )}`
// console.log('auth path: ', path)
//
// webpackConfig.output.publicPath = path
// }
// webpackConfig.resolve = webpackConfig.resolve || {}
// webpackConfig.resolve.fallback = webpackConfig.resolve.fallback || {}
// webpackConfig.resolve.fallback.process =
// require.resolve('process/browser')
//
// webpackConfig.devServer = {
// ...webpackConfig.devServer,
// devMiddleware: {
// writeToDisk: true,
// },
// }
//
// return webpackConfig
// },
},
jest: {
configure(config) {
config.moduleNameMapper = {
'^@app/(.*)$': '<rootDir>/src/app/$1',
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@constants/(.*)$': '<rootDir>/src/constants/$1',
'^@functions/(.*)$': '<rootDir>/src/utils/functions/$1',
'^@generated/(.*)$': '<rootDir>/src/features/generated/$1',
'^@utility-components/(.*)$': '<rootDir>/src/utils/components/$1',
'^@hooks/(.*)$': '<rootDir>/src/utils/hooks/$1',
'^@layouts/(.*)$': '<rootDir>/src/layouts/$1',
'^@pages/(.*)$': '<rootDir>/src/pages/$1',
'^@services/(.*)$': '<rootDir>/src/features/services/$1',
'^@styles/(.*)$': '<rootDir>/src/styles/$1',
'^@widgets/(.*)$': '<rootDir>/src/features/widgets/$1',
}
return config
},
},
}