且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

节点--experimental-modules-错误:找不到模块

更新时间:2023-11-18 17:35:10

如果有人遇到此问题,我正在回答自己的问题.

I'm answering my own question if anybody else has this problem.

事实证明,在实验模型中,您需要定义带有扩展名的完整路径.因此,我尝试导入index.js以为它会知道.

It turns out in experimental model you need to define the full path with extension. So I am trying to import index.js thinking it will know.

要修复它:

import express from 'express'
import next from 'next'
import api from './src/server/api/index.js'