application.js文件的以下内容报告未定义导入的“ home”。
import {home} from "./routes/index"
console.log(JSON.stringify(home, null, 4))
index.js的内容如下:
export * from "./home.js"
home.js的内容如下:
export const type = "GET"
export const route = "/"
export const middleware = [];
export const action = function(req, res) {
res.send("Testing custom routes");
}
目录结构图如下:
您不会导出名为的任何内容home
。如果要附加所有内容,请导出到名为的变量,home
然后使用as
。
import * as home from './routes/index';
有关导入/导出的更多信息,请参见此处。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句