Skip to content

Use node builtin module within prerender #303

@sastan

Description

@sastan

In twind we are using async_hooks to support async renders. As i understand wmr the prerender bundles are used only on server side. Would it be possible to support builtin modules for prerender?

Not working example

import {executionAsyncId, createHook} from "async_hooks";

The build fails with:

Could not load async_hooks (imported bynpm/[email protected]/server/server.js): Error: async_hooks is a Node built-in - WMR does not polyfill these

Current workaround: Using node: prefix

import {executionAsyncId, createHook} from "node:async_hooks";

The works but leads to the following warning:

'node:async_hooks' is imported bynpm/[email protected]/server/server.js, but could not be resolved – treating it as an external dependency

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions