maccounter
/
craco.config.js
23 строки · 703.0 Байт
1// eslint-disable-next-line @typescript-eslint/no-var-requires
2const { resolve, parse } = require('path')3// eslint-disable-next-line
4const pathsFromConfig = require('./tsconfig.paths.json').compilerOptions.paths5
6const mapPathsFromConfig = (oldPaths) => {7const splitAlias = (oldAlias) => oldAlias.split('/')[0]8const newPathsObject = {}9
10Object.keys(oldPaths)11.forEach((key) => {12const alias = splitAlias(key)13const handledPath = parse(oldPaths[key][0]).dir14
15newPathsObject[alias] = resolve(__dirname, 'src', handledPath)16})17
18return newPathsObject19}
20
21module.exports = {22webpack: { alias: mapPathsFromConfig(pathsFromConfig) },23}
24