Skip to content

Support plugins that execute as native ESM #1635

@cspotcode

Description

@cspotcode

Search Terms

native ecmascript, esm, plugin

Problem

It would be nice to write TypeDoc plugins as ESM modules, using node's new native ESM support

Suggested Solution

typedoc can first try to require() the plugin, then if it gets an ERR_REQUIRE_ESM error, it can import() it instead. This will support both CJS and ESM and will also support CJS transpilers like ts-node. I'm not sure if the ts-node use-case is meant to be supported or not. If not, typedoc can merely import() the plugins.

import() is async; I don't know if typedoc's plugin loading can be async.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions