Skip to content

Commit

Permalink
Resolve directory relative to webpack context
Browse files Browse the repository at this point in the history
  • Loading branch information
Nettsentrisk committed Mar 12, 2019
1 parent d93bc3b commit 70e1aa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,13 @@ class GlobEntries {
*/
apply(compiler) {
if (compiler.hooks) {
compiler.hooks.afterCompile.tapAsync(this.constructor.name, this.afterCompile.bind(this));
}
}

/**
* After compiling, give webpack the globbed files
* @param {Object} compilation
* @param {Function} callback
*/
afterCompile(compilation, callback) {
for (const directory of directories) {
compilation.contextDependencies.add(directory);
compiler.hooks.afterCompile.tapAsync(this.constructor.name, (compilation, callback) => {
for (const directory of directories) {
compilation.contextDependencies.add(path.resolve(compiler.context, directory));
}
callback();
});
}
callback();
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
},
"private": false,
"repository": "https://github.com/Nettsentrisk/globbed-webpack-entries-plugin",
"version": "1.0.1"
"version": "1.0.2"
}

0 comments on commit 70e1aa5

Please sign in to comment.