swc-node icon indicating copy to clipboard operation
swc-node copied to clipboard

Register does not support node16: Argument for '--moduleResolution' option must be 'node', 'classic'

Open linyao-reevo opened this issue 3 years ago • 0 comments

Hi, after I migrated to swc-node, running with

node -r @swc-node/register src/server.ts

throws error that claims --moduleResolution must be either node or classic, while I can confirm ts supports node16.

https://github.com/microsoft/TypeScript/blob/e1ceb2eb81bcc0768d0df501589551e3236ded96/src/compiler/commandLineParser.ts#L830-L838

        // Module Resolution
        {
            name: "moduleResolution",
            type: new Map(getEntries({
                node: ModuleResolutionKind.NodeJs,
                classic: ModuleResolutionKind.Classic,
                node16: ModuleResolutionKind.Node16,
                nodenext: ModuleResolutionKind.NodeNext,
            })),

Any clue? Thanks in advance.

linyao-reevo avatar Aug 01 '22 06:08 linyao-reevo