Skip to content

Commit 4d70b4f

Browse files
committed
add known issues
1 parent 27211ed commit 4d70b4f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/content/docs/workers/testing/vitest-integration/known-issues.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,31 @@ Using WebSockets with Durable Objects with the [`isolatedStorage`](/workers/test
3333
### Returning non-primitive values from RPC methods
3434

3535
In order to return non-primitive values (objects or classes extending `RpcTarget`, for instance) from RPC methods, you must use the `using` keyword. Refer to [https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle#explicit-resource-management](https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle#explicit-resource-management) for more details. An [example test](https://github.com/cloudflare/workers-sdk/tree/main/fixtures/vitest-pool-workers-examples/rpc/test/unit.test.ts#L155) is included in the `workers-sdk` repository.
36+
37+
### Module resolution
38+
39+
If you encounter module resolution issues—such as: `Error: Cannot use require() to import an ES Module` or `Error: No such module`—you can bundle these dependencies using the [deps.optimizer](https://vitest.dev/config/#deps-optimizer) option:
40+
41+
```tsx
42+
import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config";
43+
44+
export default defineWorkersConfig({
45+
test: {
46+
deps: {
47+
optimizer: {
48+
ssr: {
49+
enabled: true,
50+
include: ["your-package-name"],
51+
},
52+
},
53+
},
54+
poolOptions: {
55+
workers: {
56+
// ...
57+
},
58+
},
59+
},
60+
});
61+
```
62+
63+
You can find an example in the [Recipes](/workers/testing/vitest-integration/recipes) page.

0 commit comments

Comments
 (0)