我对 Next.js 和 Typescript 还很陌生。我想使用 next.js 和 typescript 以及 tailwind CSS 使用这个简单的创建应用程序命令构建一个项目:
npx create-next-app -e with-tailwindcss my-project
一切都很顺利,直到我想使用 next/image 来使用 Image 标签并出现错误
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'call')
Call Stack
options.factory
file:///C:/Users/irwan/Projects/messenger-clone/meta-messenger/.next/static/chunks/webpack.js (710:31)
__webpack_require__
/_next/static/chunks/webpack.js (37:33)
fn
file:///C:/Users/irwan/Projects/messenger-clone/meta-messenger/.next/static/chunks/webpack.js (365:21)
require
node_modules\next\dist\client\image.js (7:15)
./node_modules/next/dist/client/image.js
file:///C:/Users/irwan/Projects/messenger-clone/meta-messenger/.next/static/chunks/app/layout.js (39:1)
options.factory
/_next/static/chunks/webpack.js (710:31)
__webpack_require__
file:///C:/Users/irwan/Projects/messenger-clone/meta-messenger/.next/static/chunks/webpack.js (37:33)
fn
/_next/static/chunks/webpack.js (365:21)
__webpack_require__
node_modules\next\dist\client\app-index.js (26:16)
requireModule
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (142:0)
initializeModuleChunk
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (427:0)
resolveModuleChunk
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (385:0)
eval
node_modules\next\dist\compiled\react-server-dom-webpack\client.js (668:0)
Run Code Online (Sandbox Code Playgroud)
我确信错误与 URL 无关,因为我已经在 next.config.js 文件中添加了要列入白名单的域。
这是我的包 …