Skip to content

Commit 5b407f1

Browse files
authoredMar 7, 2019
fix: respect base of glob for context dependencies (#352)
1 parent ff1a7be commit 5b407f1

File tree

4 files changed

+250
-327
lines changed

4 files changed

+250
-327
lines changed
 

‎package-lock.json

Lines changed: 246 additions & 325 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"cacache": "^11.3.1",
4444
"find-cache-dir": "^2.0.0",
4545
"globby": "^7.1.1",
46+
"glob-parent": "^3.1.0",
4647
"is-glob": "^4.0.0",
4748
"loader-utils": "^1.1.0",
4849
"minimatch": "^3.0.4",

‎src/preProcessPattern.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path';
22

33
import isGlob from 'is-glob';
4+
import globParent from 'glob-parent';
45
import normalizePath from 'normalize-path';
56

67
import normalize from './utils/normalize';
@@ -104,7 +105,7 @@ export default function preProcessPattern(globalRef, pattern) {
104105

105106
// We need to add context directory as dependencies to avoid problems when new files added in directories
106107
// when we already in watch mode and this directories are not in context dependencies
107-
contextDependencies.add(pattern.context);
108+
contextDependencies.add(globParent(pattern.absoluteFrom));
108109
} else {
109110
const newWarning = new Error(
110111
`unable to locate '${pattern.from}' at '${pattern.absoluteFrom}'`

‎test/CopyPlugin.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ describe('apply function', () => {
689689
Array.from(compilation.contextDependencies)
690690
.map((contextDependency) => normalizePath(contextDependency))
691691
.sort()
692-
).toEqual([normalizePath(HELPER_DIR)].sort());
692+
).toEqual([normalizePath(path.join(HELPER_DIR, 'directory'))].sort());
693693
})
694694
.then(done)
695695
.catch(done);

0 commit comments

Comments
 (0)
Please sign in to comment.