Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only handle a create of the project root on Parcel startup #6644

Open
wants to merge 9 commits into
base: v2
Choose a base branch
from
27 changes: 15 additions & 12 deletions packages/core/core/src/RequestTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,18 720,6 @@ export class RequestGraph extends ContentGraph<
let filePath = fromProjectPathRelative(_filePath);
let hasFileRequest = this.hasContentKey(filePath);

// If we see a 'create' event for the project root itself,
// this means the project root was moved and we need to
// re-run all requests.
if (type === 'create' && filePath === '') {
for (let [id, node] of this.nodes) {
if (node.type === 'request') {
this.invalidNodeIds.add(id);
}
}
return true;
}

// sometimes mac os reports update events as create events.
// if it was a create event, but the file already exists in the graph,
// then also invalidate nodes connected by invalidated_by_update edges.
Expand Down Expand Up @@ -1162,6 1150,21 @@ async function loadRequestGraph(options): Async<RequestGraph> {
snapshotPath,
opts,
);

// If we see a 'create' event for the project root itself,
// this means the project root was moved and we need to
// re-run all requests.
if (
events.some(e => e.path === options.projectRoot && e.type === 'create')
) {
for (let [id, node] of requestGraph.nodes) {
if (node.type === 'request') {
requestGraph.invalidNodeIds.add(id);
}
}
return requestGraph;
}

requestGraph.invalidateUnpredictableNodes();
requestGraph.invalidateOnBuildNodes();
requestGraph.invalidateEnvNodes(options.env);
Expand Down