reactjs 参考错误:下一个Js中未定义窗口

p3rjfoxz  于 2023-03-01  发布在  React
关注(0)|答案(1)|浏览(160)
error - ReferenceError: window is not defined
    at Object.<anonymous> (D:\ZZZ\my_app\node_modules\react-flip-page\dist\index.js:1:254)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at react-flip-page (D:\ZZZ\my_app\.next\server\pages\index.js:76:18)
    at __webpack_require__ (D:\ZZZ\my_app\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/pages/Page2.js:9:73)
    at ./src/pages/Page2.js (D:\ZZZ\my_app\.next\server\pages\index.js:32:1)
    at __webpack_require__ (D:\ZZZ\my_app\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/pages/index.js:11:73)
    at ./src/pages/index.js (D:\ZZZ\my_app\.next\server\pages\index.js:43:1)
    at __webpack_require__ (D:\ZZZ\my_app\.next\server\webpack-runtime.js:33:42)
    at __webpack_exec__ (D:\ZZZ\my_app\.next\server\pages\index.js:97:39)
    at D:\ZZZ\my_app\.next\server\pages\index.js:98:28
    at Object.<anonymous> (D:\ZZZ\my_app\.next\server\pages\index.js:101:3)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.requirePage (D:\ZZZ\my_app\node_modules\next\dist\server\require.js:88:12)
    at D:\ZZZ\my_app\node_modules\next\dist\server\load-components.js:49:73
    at async Object.loadComponentsImpl [as loadComponents] (D:\ZZZ\my_app\node_modules\next\dist\server\load-components.js:49:26)
    at async DevServer.findPageComponentsImpl (D:\ZZZ\my_app\node_modules\next\dist\server\next-server.js:599:36) {
  page: '/'
}

我正在使用react-flip-page-library,即使我没有使用node,它也会抛出这个错误。
我正在使用react-flip-page-library,即使我没有使用node,它也会抛出这个错误。

pw9qyyiw

pw9qyyiw1#

希望这能帮上忙

const FlipBook = dynamic(() => import('react-flip-page'), {
  ssr: false,
})

相关问题