8000 window is not defined error after upgrading to NativeScript 8.1 · Issue #9670 · NativeScript/NativeScript · GitHub
[go: up one dir, main page]

Skip to content
window is not defined error after upgrading to NativeScript 8.1 #9670
Open
@justintoth

Description

@justintoth

Issue Description

For the past 4 days I have been attempting to upgrade my NativeScript / Angular code sharing (nativescript-schematics) app from NativeScript 8.0 to 8.1 and Angular 11 to 12, after working my way through 20+ build errors (100 github / SO threads read, 75 npm installs, and 50 ns cleans did the trick.) I'm really close to getting up and running with the latest and greatest now. My app builds on iOS, however as soon as it launches my app on the iOS simulator it throws the following error:

ReferenceError: window is not defined
at BrowserPlatformLocation._init (file: src/webpack:/housters/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:124:0)
at new BrowserPlatformLocation (file: src/webpack:/housters/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:119:0)
at Object.createBrowserPlatformLocation [as factory] (file: src/webpack:/housters/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:213:0)
at R3Injector.hydrate (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11457:0)
at R3Injector.get (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11276:0)
at injectInjectorOnly (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:4770:0)
at ɵɵinject (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:4774:0)
at Object.useBrowserPlatformLocation [as factory] (file: src/webpack:/housters/node_modules/@angular/common/__ivy_ngcc__/fesm2015/common.js:101:19)
at R3Injector.hydrate (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11457:0)
at R3Injector.get (file: src/webpack:/housters/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:11276:0)

I could really use some assistance getting over the finish line...

Reproduction

Here is my package.json file:
https://gist.github.com/justintoth/be80c66d9e9dbeab653d2095be79def6

Here is my webpack.config.js:

const webpack = require("@nativescript/webpack");

module.exports = (env) => {
	webpack.init(env);
	return webpack.resolveConfig();
};

Relevant log output (if applicable)

https://gist.github.com/justintoth/9c7812a92c20b32a30cac113782d33fe

Environment

The npx -y nativescript-envinfo command didn't work, but here is the ns doctor output:

MacBook-Pro:UI justintoth$ ns doctor
✔ Getting environment information

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 13.1.0 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.1.4 version and is up to date.
✔ Component @nativescript/core has 8.1.5 version and is up to date.
✔ Component @nativescript/ios has 8.1.0 version and is up to date.
✔ Component @nativescript/android has 8.1.1 version and is up to date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0