我希望将 ES2015 模块用于项目。根据节点文档,我正在启用.esm
加载器:
~\Code\spa-test $ node --experimental-modules (node:8104) ExperimentalWarning: The ESM module loader is experimental.
> import * as sapper from '@sapper/server'; Thrown:
import * as sapper from '@sapper/server';
^
SyntaxError: Unexpected token *
我也试过:
import {middleware} from '@sapper/server';
哪个失败了SyntaxError: Unexpected token {
如何让 node.js 加载@sapper/server
ESM 模块?