首页 > 解决方案 > Next.js 自定义打字稿服务器

问题描述

我有一个带有两个 next.js 应用程序的 monorepo。以及这两个应用程序的通用库。我需要自定义服务器来处理语言环境路由。执行自定义服务器并使用 ts-node 运行,例如:https ://github.com/vercel/next.js/tree/canary/examples/custom-server-typescript

但无法在 next.js 应用程序之外导入 smth 并出现错误:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

如何创建自定义服务器并在 next.js 目录之外导入一些打字稿模块?

标签: typescriptnext.js

解决方案


推荐阅读