You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@capacitor/android: not installed
@capacitor/cli: 3.2.5
@capacitor/core: 3.2.5
@capacitor/ios: 3.2.5
Platform(s)
iOS
Web
Current Behavior
When I import the Network plugin in the manner described by the documentation - https://capacitorjs.com/docs/apis/network - I receive the error "ReferenceError: window is not defined" when trying to view my project on my dev server or when trying to compile for iOS.
Server Error
Call Stack
new NetworkWeb
/node_modules/@capacitor/network/dist/plugin.cjs.js (67:9)
Expected Behavior
That I can import the Network plugin without this error.
Navigate to server in your browser, view the error.
Comment out line import { Network } from '@capacitor/network'; in src/pages/index.js
Refresh page in browser, observe that it now works.
Other Technical Details
The project is a pretty straight-up next/js project. When I comment out the Network import everything seems fine as the error seems to be within the NetworkWeb class within the plugin. Maybe I'm just doing something super basic wrong because it seems too big of an error to slip through, but on the other hand after looking around I'm finding no obvious answers and the Plugin version seems very new.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.
Bug Report
Plugin(s)
Capacitor Version
Latest Dependencies:
@capacitor/cli: 3.2.5
@capacitor/core: 3.2.5
@capacitor/android: 3.2.5
@capacitor/ios: 3.2.5
Installed Dependencies:
@capacitor/android: not installed
@capacitor/cli: 3.2.5
@capacitor/core: 3.2.5
@capacitor/ios: 3.2.5
Platform(s)
Current Behavior
When I import the Network plugin in the manner described by the documentation - https://capacitorjs.com/docs/apis/network - I receive the error "ReferenceError: window is not defined" when trying to view my project on my dev server or when trying to compile for iOS.
Expected Behavior
That I can import the Network plugin without this error.
Code Reproduction
https://github.com/samloomes/capacitor-network-import-error
npm run dev
import { Network } from '@capacitor/network';
in src/pages/index.jsOther Technical Details
The project is a pretty straight-up next/js project. When I comment out the Network import everything seems fine as the error seems to be within the NetworkWeb class within the plugin. Maybe I'm just doing something super basic wrong because it seems too big of an error to slip through, but on the other hand after looking around I'm finding no obvious answers and the Plugin version seems very new.
The following is my current package.json.
The text was updated successfully, but these errors were encountered: