Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 6f88a1d

Browse files
committed
fix: tell the {N} CLI to ignore the source dir when watching for changes
fixes #584
1 parent e349fa8 commit 6f88a1d

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

Diff for: lib/before-watchPatterns.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
11
const { basename } = require("path");
2-
const {
3-
buildEnvData,
4-
getCompilationContext,
5-
} = require("./utils");
2+
const { getAppPathFromProjectData } = require("../projectHelpers");
63

74
module.exports = function (hookArgs) {
85
const { liveSyncData } = hookArgs;
96
if (!liveSyncData || !liveSyncData.bundle) {
107
return;
118
}
129

13-
const { platforms } = hookArgs;
14-
const { env } = liveSyncData;
1510
return (args, originalMethod) => {
1611
return originalMethod(...args).then(originalPatterns => {
17-
if (!platforms || !platforms.length) {
18-
throw new Error("Target platform should be specified!");
19-
}
2012

21-
const compilationContexts = platforms.map(platform =>
22-
getContext(hookArgs.projectData, platform, env));
13+
const appPath = getAppPathFromProjectData(hookArgs.projectData);
14+
const ignorePattern = `!${appPath}`;
2315

24-
const ignorePatterns = compilationContexts.map(
25-
context => `!${context}`
26-
);
27-
28-
return [...originalPatterns, ...ignorePatterns];
16+
return [...originalPatterns, ignorePattern];
2917
});
3018
};
3119
}
32-
33-
function getContext(projectData, platform, env) {
34-
const fullEnvData = buildEnvData(projectData, platform, env);
35-
return getCompilationContext(projectData.projectDir, fullEnvData);
36-
}

0 commit comments

Comments
 (0)