相关疑难解决方法(0)

在 jsconfig.json 中使用 baseUrl 不适用于 NextJS

https://github.com/hutber/jsconfigerror示例 repo 显示 jsconfig 不起作用。

我的jsconig.json文件中有以下设置:

{
  "compilerOptions": {
    "baseUrl": "./"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我进行导入时,它失败了:

./pages/index.js
Module not found: Can't resolve 'components/AThing' in '/var/www/gd.hutuber.com/pages'
Run Code Online (Sandbox Code Playgroud)

文件夹结构

¬ components
   ¬ AThing
¬ pages
   ¬ index.js
Run Code Online (Sandbox Code Playgroud)

页面/index.js

import Head from 'components/AThing'
Run Code Online (Sandbox Code Playgroud)

我怎样才能开始baseUrl工作nextjs

javascript next.js

9
推荐指数
3
解决办法
1万
查看次数

标签 统计

javascript ×1

next.js ×1