src/utils/removeModuleAlias.js
function removeModuleAlias(moduleName, folder, replacement = './') {
    return __awaiter(this, void 0, void 0, function* () {
        fs.readdirSync(folder).forEach(child => {
            if (fs.statSync(folder + '/' + child).isDirectory()) {
                removeModuleAlias(moduleName, folder + '/' + child, './.' + replacement);
            }
            else {
                fs.writeFileSync(folder + '/' + child, fs
                    .readFileSync(folder + '/' + child, 'utf8')
                    .split(`require("${moduleName}/`)
                    .join(`require("${replacement}`)
                    .split(`require("./../`)
                    .join(`require("../`)
                    .split(`require('${moduleName}/`)
                    .join(`require('${replacement}`)
                    .split(`require('./../`)
                    .join(`require('../`)
                    .split(`from '${moduleName}/`)
                    .join(`from '${replacement}`)
                    .split(`from './../`)
                    .join(`from '../`)
                    .split(`module":"${moduleName}/`)
                    .join(`module":"${replacement}`)
                    .split(`module":"./../`)
                    .join(`module":"../`));
            }
        });
        return Promise.resolve();
    });
}
function removeModuleAlias(moduleName, folder, replacement = './') {
    return __awaiter(this, void 0, void 0, function* () {
        fs.readdirSync(folder).forEach(child => {
            if (fs.statSync(folder + '/' + child).isDirectory()) {
                removeModuleAlias(moduleName, folder + '/' + child, './.' + replacement);
            }
            else {
                fs.writeFileSync(folder + '/' + child, fs
                    .readFileSync(folder + '/' + child, 'utf8')
                    .split(`require("${moduleName}/`)
                    .join(`require("${replacement}`)
                    .split(`require("./../`)
                    .join(`require("../`)
                    .split(`require('${moduleName}/`)
                    .join(`require('${replacement}`)
                    .split(`require('./../`)
                    .join(`require('../`)
                    .split(`from '${moduleName}/`)
                    .join(`from '${replacement}`)
                    .split(`from './../`)
                    .join(`from '../`)
                    .split(`module":"${moduleName}/`)
                    .join(`module":"${replacement}`)
                    .split(`module":"./../`)
                    .join(`module":"../`));
            }
        });
        return Promise.resolve();
    });
}
function removeModuleAlias ( moduleName , folder , replacement = './' ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { fs . readdirSync ( folder ) . forEach ( child => { if ( fs . statSync ( folder + '/' + child ) . isDirectory ( ) ) { removeModuleAlias ( moduleName , folder + '/' + child , './.' + replacement ) ; } else { fs . writeFileSync ( folder + '/' + child , fs . readFileSync ( folder + '/' + child , 'utf8' ) . split ( ` ${ moduleName } ` ) . join ( ` ${ replacement } ` ) . split ( ` ` ) . join ( ` ` ) . split ( ` ${ moduleName } ` ) . join ( ` ${ replacement } ` ) . split ( ` ` ) . join ( ` ` ) . split ( ` ${ moduleName } ` ) . join ( ` ${ replacement } ` ) . split ( ` ` ) . join ( ` ` ) . split ( ` ${ moduleName } ` ) . join ( ` ${ replacement } ` ) . split ( ` ` ) . join ( ` ` ) ) ; } } ) ; return Promise . resolve ( ) ; } ) ; }
Remove Module Alias
Remove Module Alias