Skip to content

Commit

Permalink
Fix returning watchFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
EMH333 committed Sep 5, 2023
1 parent 48777f1 commit 5be8376
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,20 @@ export default function sveltePlugin(options?: esbuildSvelteOptions): Plugin {
}

// make sure to tell esbuild to watch any additional files used if supported
result.watchFiles = Array.from(dependencyModifcationTimes.keys());
// only provide if context API is supported or we are caching
if (build.esbuild?.context !== undefined || shouldCache(build)) {
result.watchFiles = Array.from(dependencyModifcationTimes.keys());
}

return result;
} catch (e: any) {
return { errors: [convertMessage(e)], watchFiles: previousWatchFiles };
let result: OnLoadResult = {};
result.errors = [convertMessage(e)];
// only provide if context API is supported or we are caching
if (build.esbuild?.context !== undefined || shouldCache(build)) {
result.watchFiles = previousWatchFiles;
}
return result;
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"preversion": "npm run lint && npm run build && npm test && npm run test:compatibility",
"pretest": "tsc -p tsconfig.json --noEmit",
"test": "uvu test/ .*\\.mjs",
"test:compatibility": "test/versionTests/versionTests.sh",
"test:compatibility": "npm run build && test/versionTests/versionTests.sh",
"build": "node build.js",
"lint": "prettier --check --cache .",
"fix": "prettier --write --cache ."
Expand Down

0 comments on commit 5be8376

Please sign in to comment.