Skip to content

Commit

Permalink
fix(nodeModulesRoot): now node modules resolves only once, but not fo…
Browse files Browse the repository at this point in the history
…r every file
  • Loading branch information
RyuuGan committed Dec 13, 2018
1 parent d940da7 commit 5a92283
Show file tree
Hide file tree
Showing 4 changed files with 939 additions and 1,025 deletions.
4 changes: 3 additions & 1 deletion lib/merger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Merger {

this.delimeter = delimeter || '\n\n';
this.processedFiles = [];
this.nodeModulesRoot = null;
}

getPragmaRegex() {
Expand All @@ -38,6 +39,7 @@ class Merger {
async processFile(file, isRoot) {
if (isRoot) {
this.processedFiles = [];
this.nodeModulesRoot = await this.getNodeModulesPath(file);
}
if (this.processedFiles.indexOf(file) !== -1) {
log('%s %s', '⚠', file);
Expand Down Expand Up @@ -77,7 +79,7 @@ class Merger {

let filePath = Utils.isRelative(_importFile) ?
path.join(path.dirname(file), _importFile) :
path.join(await this.getNodeModulesPath(file), './' + _importFile);
path.join(this.nodeModulesRoot, './' + _importFile);

filePath = path.normalize(filePath);

Expand Down
Loading

0 comments on commit 5a92283

Please sign in to comment.