swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.72k stars 71 forks source link

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

Closed linyaoli closed 1 year ago

linyaoli commented 1 year ago

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.

Brooooooklyn commented 1 year ago

Closed in https://github.com/swc-project/swc-node/pull/643