plugins: symlink node_modules into dist plugin dir for bare-specifier resolution

This commit is contained in:
Val Alexander
2026-03-18 00:14:01 -05:00
parent bfecc58a62
commit 0a57b507d5
2 changed files with 16 additions and 0 deletions

View File

@@ -49,6 +49,12 @@ describe("stageBundledPluginRuntime", () => {
expect(fs.realpathSync(path.join(runtimePluginDir, "node_modules"))).toBe(
fs.realpathSync(sourcePluginNodeModulesDir),
);
// dist/ also gets a node_modules symlink so bare-specifier resolution works
// from the actual code location that the runtime wrapper re-exports into
const distNodeModules = path.join(distPluginDir, "node_modules");
expect(fs.lstatSync(distNodeModules).isSymbolicLink()).toBe(true);
expect(fs.realpathSync(distNodeModules)).toBe(fs.realpathSync(sourcePluginNodeModulesDir));
});
it("writes wrappers that forward plugin entry imports into canonical dist files", async () => {