在進行一些更改后,我遇到了部署到 Vercel 的問題。與npm run dev作品一起運行,但在部署到 Vercel(與 一起運行npm run build)后,它咳出一個錯誤:
126 at /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:59452:6 09:53:00.126 at done (/vercel/path0/node_modules/next/dist/compiled/neo-async/async .js:1:10308) 09:53:00.126 在 /vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:59356:13 09:53:00.126 在 /vercel/path0/node_modules/next/ dist/compiled/webpack/bundle5.js:135587:5 09:53:00.126 at Hook.eval [as callAsync] (eval at create (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js: 33832:10), :6:1) 09:53:00.127 at AsyncQueue._handleResult (/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:135557:21) 09:53:00.127 at / vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:135540:11 09:53:00.127 在 Array。(/vercel/path0/node_modules/next/dist/compiled/webpack/bundle5.js:59296:
抱歉,如果格式很難閱讀,我不太確定如何在不運行格式的情況下復制錯誤日志。
我所做的所有更改都可以歸結為添加一個Layout使用NavBar, and Footer組件的組件。然后我修改了_app.js檔案以使用所述布局:
import React from "react";
import App from "next/app";
import "tailwindcss/tailwind.css";
import Layout from "../components/Layout";
class MyApp extends App {
render() {
const { Component, pageProps, router } = this.props;
if (router.pathname.startsWith("/shop/")) { //router path check to include/exclude Layout e.g: paths starting with /shop
return (
<Layout>
<Component {...pageProps}></Component>
</Layout>
);
}
return <Component {...pageProps}></Component>;
}
}
export default MyApp;
非常感謝有關此錯誤的任何見解!
uj5u.com熱心網友回復:
我們不從下面這樣的反應模塊中匯入 Component 的保留關鍵字并用于擴展類
import React, { Component } from "react";
class SomeNavComponent extends Component {
此外,在我看來,問題似乎出在組件的命名上
const { Component, pageProps, router } = this.props;
uj5u.com熱心網友回復:
沒有改變任何東西,在再次推送到 Vercel 之后,錯誤沒有彈出,所以我猜現在它是“修復的”。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/341226.html
標籤:javascript 节点.js 反应 网络包 原汁原味的
上一篇:Angular12 webpack5 AOTbuild-無法生成ngfactory檔案
下一篇:無法部署不存在的路徑
