mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
fix array exception on files broker
This commit is contained in:
@@ -8,7 +8,7 @@ const filesList = globSync('dist/**/*.js');
|
|||||||
filesList.forEach(file => {
|
filesList.forEach(file => {
|
||||||
let raw = fs.readFileSync(file, 'utf8');
|
let raw = fs.readFileSync(file, 'utf8');
|
||||||
for (const path in paths) {
|
for (const path in paths) {
|
||||||
const deep = (file.match(/\\/g) || []).length;
|
const deep = (file.match(/\\|\//g) || []).length;
|
||||||
const pathText = path.replace('*', '');
|
const pathText = path.replace('*', '');
|
||||||
const toReplaceText = new RegExp(`"${pathText}(.*?)"`, 'g');
|
const toReplaceText = new RegExp(`"${pathText}(.*?)"`, 'g');
|
||||||
raw = raw.replace(toReplaceText, `"${new Array(deep - 2).fill('../').join('')}${paths[path][0].replace('*', '')}${'$1'}"`);
|
raw = raw.replace(toReplaceText, `"${new Array(deep - 2).fill('../').join('')}${paths[path][0].replace('*', '')}${'$1'}"`);
|
||||||
|
|||||||
Reference in New Issue
Block a user