Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit dd092bd

Browse files
author
sw-yx
committed
fix phil bug
1 parent 3ed5438 commit dd092bd

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

package-lock.json

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/serve-functions.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ function createHandler(dir) {
101101
delete require.cache[require.resolve(fn.functionPath)];
102102
module.paths = before;
103103
};
104-
fn.watcher = chokidar.watch(
105-
[fn.functionPath, path.join(fn.moduleDir, "package.json")],
106-
{
107-
ignored: /node_modules/
108-
}
109-
);
104+
const pathsToWatch = [fn.functionPath];
105+
if (fn.moduleDir) {
106+
pathsToWatch.push(path.join(fn.moduleDir, "package.json"));
107+
}
108+
fn.watcher = chokidar.watch(pathsToWatch, {
109+
ignored: /node_modules/
110+
});
110111
fn.watcher
111112
.on("add", clearCache)
112113
.on("change", clearCache)

0 commit comments

Comments
 (0)