NextJS从v9.x.x升级到v12.x.x后出现TypeError: file.endsWith is not a function
NextJS v9.x.x 升级至 v12.x.x 后出现 TypeError 求助
升级后出现如下错误:
TypeError: file.endsWith is not a function at eval (webpack-internal:///./node_modules/next/dist/pages/_document.js:171:60) at Array.filter (<anonymous>) at getScripts (webpack-internal:///./node_modules/next/dist/pages/_document.js:171:40) at Head.getScripts (webpack-internal:///./node_modules/next/dist/pages/_document.js:367:12) at getDynamicScriptContent (webpack-internal:///./node_modules/next/dist/pages/_document.js:553:297) at eval (webpack-internal:///./node_modules/next/dist/pages/_document.js:557:142) at useMaybeDeferContent (/Users/majid.hussain/workspace/hub-next/node_modules/next/dist/server/render.js:1251:9) at DeferrableHead (webpack-internal:///./node_modules/next/dist/pages/_document.js:556:28) at processChild (/Users/majid.hussain/workspace/hub-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14) at resolve (/Users/majid.hussain/workspace/hub-next/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
错误起源的转译代码:
为排查空值问题添加了console.log,输出结果如下:
{ sharedFiles: [ 'static/chunks/fallback/webpack.js', 'static/chunks/fallback/main.js', 'static/chunks/fallback/pages/_app.js' ], pageFiles: [ 'static/chunks/fallback/webpack.js', 'static/chunks/fallback/main.js', 'static/chunks/fallback/pages/_error.js' ], allFiles: [ 'static/chunks/fallback/webpack.js', 'static/chunks/fallback/main.js', 'static/chunks/fallback/pages/_app.js', 'static/chunks/fallback/pages/_error.js' ] }
内容的提问来源于stack exchange,提问作者Majid
相关产品推荐
相关产品推荐

