Explorar o código

Merge pull request #8210 from blink1073/webpack-watch-fix

Clean up file watching
Steven Silvester %!s(int64=5) %!d(string=hai) anos
pai
achega
4d6a129c06
Modificáronse 1 ficheiros con 2 adicións e 26 borrados
  1. 2 26
      dev_mode/webpack.config.js

+ 2 - 26
dev_mode/webpack.config.js

@@ -65,30 +65,6 @@ let sourceMapRes = Object.values(watched).reduce((res, name) => {
   return res;
 }, []);
 
-/**
- * Sync a local path to a linked package path if they are files and differ.
- */
-function maybeSync(localPath, name, rest) {
-  const stats = fs.statSync(localPath);
-  if (!stats.isFile(localPath)) {
-    return;
-  }
-  const source = fs.realpathSync(plib.join(jlab.linkedPackages[name], rest));
-  if (source === fs.realpathSync(localPath)) {
-    return;
-  }
-  fs.watchFile(source, { interval: 500 }, function(curr) {
-    if (!curr || curr.nlink === 0) {
-      return;
-    }
-    try {
-      fs.copySync(source, localPath);
-    } catch (err) {
-      console.error(err);
-    }
-  });
-}
-
 /**
  * A filter function set up to exclude all files that are not
  * in a package contained by the Jupyterlab repo. Used to ignore
@@ -112,7 +88,6 @@ function ignored(path) {
     const rest = path.slice(rootPath.length);
     if (rest.indexOf('node_modules') === -1) {
       ignore = false;
-      maybeSync(path, name, rest);
     }
     return true;
   });
@@ -274,7 +249,8 @@ module.exports = [
       ]
     },
     watchOptions: {
-      poll: 333
+      poll: 500,
+      aggregateTimeout: 1000
     },
     node: {
       fs: 'empty'