From f1aa3ca8ac982eae2f73cada1ece1d65e3dcb44d Mon Sep 17 00:00:00 2001 From: Harrison Ifeanyichukwu Date: Mon, 4 Mar 2019 12:38:10 +0100 Subject: [PATCH] fix: fix multi-folder mix up during build --- src/modules/Bundler.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/modules/Bundler.js b/src/modules/Bundler.js index 4001f32..a7ab138 100644 --- a/src/modules/Bundler.js +++ b/src/modules/Bundler.js @@ -148,28 +148,27 @@ export default class Bundler { const filePath = path.join(resolvedPath, file); if (fs.statSync(filePath).isDirectory()) { - relDir = path.join(relDir, file); this.getModules( modules, filePath, mainModuleFileName, mainModuleName, - relDir, fileExtensions + path.join(relDir, file), fileExtensions ); - continue; } + else { + const extname = path.extname(file); + const baseName = path.basename(file, extname); - const extname = path.extname(file); - const baseName = path.basename(file, extname); - - const isAsset = !fileExtensions.includes(extname); + const isAsset = !fileExtensions.includes(extname); - const oldRelPath = path.join(relDir, file); - const relPath = path.join(relDir, baseName + '.js'); + const oldRelPath = path.join(relDir, file); + const relPath = path.join(relDir, baseName + '.js'); - modules.push({ - relPath: isAsset ? oldRelPath : relPath, - name: oldRelPath === mainModuleFileName ? mainModuleName : baseName, - isAsset, - absPath: filePath - }); + modules.push({ + relPath: isAsset ? oldRelPath : relPath, + name: oldRelPath === mainModuleFileName ? mainModuleName : baseName, + isAsset, + absPath: filePath + }); + } } return modules; } @@ -266,6 +265,9 @@ export default class Bundler { //define the exportStore exportStore = []; + console.log(modules); + console.log(externalModules); + if (!libConfig.disabled) this.getExports( exportStore,