NextJS 导入位置样式?

问题描述 投票:0回答:1

我已经有一个项目,其中有一个正在导入以下函数的文件

import theme from 'src/configs/theme'

但是当我创建新的nextjs项目并创建相同的文件夹结构并导入相同的函数时,它说找不到模块,如果我将其更改为

它就可以工作

import theme from '../../configs/theme'
,我有什么遗漏的吗?上面的看起来更干净清晰

node.js typescript next.js coding-style
1个回答
0
投票

刚刚找到答案,我必须添加

"baseUrl": ".",

在 tsconfig.json 文件的

compilerOption

© www.soinside.com 2019 - 2024. All rights reserved.