wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.39k stars 1.23k forks source link

Window is not defined Error #2959

Open 9dl opened 1 year ago

9dl commented 1 year ago

Description

When compiling i get Window not defined error, but it works when only using "wails dev"

To Reproduce

wails build

Expected behaviour

build it

Screenshots

No response

Attempted Fixes

No response

System Details

# System
┌────────────────────────────────────┐
| OS           | Windows 10 Home     |
| Version      | 2009 (Build: 22621) |
| ID           | 22H2                |
| Go Version   | go1.21.1            |
| Platform     | windows             |
| Architecture | amd64               |
└────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 117.0.2045.47 |
| Nodejs     | N/A          | Installed | 18.18.0       |
| npm        | N/A          | Installed | 9.8.1         |
| *upx       | N/A          | Available |               |
| *nsis      | N/A          | Available |               |
└─────────────── * - Optional Dependency ───────────────┘

Additional context

info  - Generating static pages (2/9)
info  - Generating static pages (4/9)
info  - Generating static pages (6/9)
info  - Generating static pages (9/9)

error - ESLint: Failed to load config "next/babel" to extend from. Referenced from: D:\HQTargetUI\frontend\.eslintrc.json
ReferenceError: window is not defined
    at GlobalStats (D:\HQTargetUI\frontend\.next\server\chunks\750.js:26:5)
    at Dashboard (D:\HQTargetUI\frontend\.next\server\pages\dashboard.js:208:80)
    at Wc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)

Error occurred prerendering page "/dashboard". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: window is not defined
    at GlobalStats (D:\HQTargetUI\frontend\.next\server\chunks\750.js:26:5)
    at Dashboard (D:\HQTargetUI\frontend\.next\server\pages\dashboard.js:208:80)
    at Wc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at Zc (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:481)
    at Z (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
    at $c (D:\HQTargetUI\frontend\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)

> Export encountered errors on following paths:
    /dashboard
leaanthony commented 1 year ago

Thanks for opening this. Because we cannot access your source code and the minimal build above is just wails build, which works fine, I'm going to mark this as cannot reproduce. Feel free to provide more information if you want.