Unverified Commit b2bf4467 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Optimize watch ignore (#52238)

## What?

Uses a pre-created regex instead of having webpack run path-to-regexp on the list of patterns. Saves a few milliseconds.
Adds `node_modules` to ignored in order to skip a lot of stat calls at the end of the compilation.

This will likely have a big impact on applications using Yarn PnP as each stat call causes a lookup through `.pnp.cjs`.
parent 972d29b6
......@@ -152,7 +152,9 @@ const nodePathList = (process.env.NODE_PATH || '')
const watchOptions = Object.freeze({
aggregateTimeout: 5,
ignored: ['**/.git/**', '**/.next/**'],
ignored:
// Matches **/node_modules/**, **/.git/** and **/.next/**
/^((?:[^/]*(?:\/|$))*)(\.(git|next)|node_modules)(\/((?:[^/]*(?:\/|$))*)(?:$|\/))?/,
})
function isModuleCSS(module: { type: string }) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment