From b4c43cd508bd57dcb2c0762b183854436d3d15de Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Mon, 19 Dec 2022 19:24:41 +0900 Subject: [PATCH] fix: allow assigning new hotContext (#2524) * Allow assigning new hotContext * fix lint * add a regression case --- packages/vite-node/src/client.ts | 3 +++ test/vite-node/src/deps.css | 3 +++ test/vite-node/src/deps.ts | 2 ++ 3 files changed, 8 insertions(+) create mode 100644 test/vite-node/src/deps.css diff --git a/packages/vite-node/src/client.ts b/packages/vite-node/src/client.ts index 00a2e1176271..24a314c6da2e 100644 --- a/packages/vite-node/src/client.ts +++ b/packages/vite-node/src/client.ts @@ -323,6 +323,9 @@ export class ViteNodeRunner { hotContext ||= this.options.createHotContext?.(this, `/@fs/${fsPath}`) return hotContext }, + set: (value) => { + hotContext = value + }, }) } diff --git a/test/vite-node/src/deps.css b/test/vite-node/src/deps.css new file mode 100644 index 000000000000..293d3b1f1316 --- /dev/null +++ b/test/vite-node/src/deps.css @@ -0,0 +1,3 @@ +body { + margin: 0; +} diff --git a/test/vite-node/src/deps.ts b/test/vite-node/src/deps.ts index 285eb842f8ad..c81840a1d46e 100644 --- a/test/vite-node/src/deps.ts +++ b/test/vite-node/src/deps.ts @@ -1,3 +1,5 @@ +import './deps.css' + // eslint-disable-next-line no-console console.log('deps')