Yil*_*maz 13 typescript server-side-rendering next.js
我正在构建下一个项目的打字稿。如果我将此配置文件保留为next.config.js,我会收到一条警告tsconfig.json“未找到 next.config.ts”。所以 tsconfig.json 上有警告标志{}。
如果我将扩展名更改为.ts,当我启动项目时,我会收到以下错误:
“错误:不支持通过‘next.config.ts’配置 Next.js。请将该文件替换为‘next.config.js’。”
我很困惑,我不知道该怎么办。
ts.config.json
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"sourceMap": true,
"removeComments": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Run Code Online (Sandbox Code Playgroud)
下一个.config.ts
const path = require("path");
const Dotenv = require("dotenv-webpack");
module.exports = {
env: {
AUTH0_NAMESPACE: process.env.AUTH0_NAMESPACE,
BASE_URL: process.env.BASE_URL,
},
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11123 次 |
| 最近记录: |