capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
320 stars 58 forks source link

shell.openExternal() raising errors #163

Open ogadepoju opened 2 years ago

ogadepoju commented 2 years ago

Hello, I once asked a question on how to open a url with my ionic desktop app using @capacitor-community/electron, which i got an answer to use: import { shell } from '@capacitor-community/electron'; shell.openExternal(url); which i believe could would work, but it raising the following errors when i run npm run build

./electron/node_modules/fsevents/fsevents.node:1:0 - Error: Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders (Source code omitted for this binary file)

@capacitor-community/electron:1:1122-1135 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\node_modules\@capacitor-community\electron\dist\core'

@capacitor-community/electron:1:1168-1183 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\node_modules\@capacitor-community\electron\dist\core'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/builder-util-runtime/out/ProgressCallbackTransform.js:4:17-34 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\builder-util-runtime\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/builder-util-runtime/out/httpExecutor.js:4:17-34 - Error: Module not found: Error: Can't resolve 'crypto' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\builder-util-runtime\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/builder-util-runtime/out/httpExecutor.js:6:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\builder-util-runtime\out'

./electron/node_modules/builder-util-runtime/out/httpExecutor.js:7:17-34 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\builder-util-runtime\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/builder-util-runtime/out/uuid.js:4:17-34 - Error: mModule not found: Error: Can't resolve 'crypto' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\builder-util-runtime\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/chokidar/index.js:4:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar'

./electron/node_modules/chokidar/index.js:5:16-31 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/chokidar/lib/constants.js:3:14-29 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/chokidar/lib/constants.js:5:11-24 - Error: Module not found: Error: Can't resolve 'os' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/chokidar/lib/fsevents-handler.js:3:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

./electron/node_modules/chokidar/lib/fsevents-handler.js:4:16-31 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/chokidar/lib/nodefs-handler.js:3:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

./electron/node_modules/chokidar/lib/nodefs-handler.js:4:16-31 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\chokidar\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-serve/index.js:2:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-serve'

./electron/node_modules/electron-serve/index.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-serve'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/copy-sync/copy-sync.js:4:13-28[39m - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\copy-sync'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/copy/copy.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\copy'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/empty/index.js:5:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\empty'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/ensure/file.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/ensure/link.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/ensure/symlink-paths.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/ensure/symlink.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/mkdirs/utils.js:7:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\mkdirs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/move-sync/move-sync.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\move-sync'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/move/move.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\move'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/output/index.js:5:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\output'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/remove/rimraf.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\remove'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/remove/rimraf.js:5:15-32 - Error: Module not found: Error: Can't resolve 'assert' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\remove'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/node_modules/fs-extra/lib/util/stat.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\node_modules\fs-extra\lib\util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/AppAdapter.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/AppAdapter.js:5:13-26 - Error: Module not found: Error: Can't resolve 'os' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/AppImageUpdater.js:5:24-48 - Error: Module not found: Error: Can't resolve 'child_process' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/AppImageUpdater.js:7:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/AppImageUpdater.js:8:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/AppUpdater.js:5:17-34 - Error: Module not found: Error: Can't resolve 'crypto' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/AppUpdater.js:8:19-41 - Error: Module not found: Error: Can't resolve 'fs/promises' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/AppUpdater.js:11:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/DownloadedUpdateHelper.js:4:17-34 - Error: Module not found: Error: Can't resolve 'crypto' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/DownloadedUpdateHelper.js:5:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/DownloadedUpdateHelper.js:9:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/ElectronAppAdapter.js:4:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/MacUpdater.js:6:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/MacUpdater.js:7:15-30 - Error: Module not found: Error: Can't resolve 'http' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/MacUpdater.js:10:24-48 - Error: Module not found: Error: Can't resolve 'child_process' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/NsisUpdater.js:5:24-48 - Error: Module not found: Error: Can't resolve 'child_process' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/NsisUpdater.js:6:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/NsisUpdater.js:16:15-30 - Error: Module not found: Error: Can't resolve 'zlib' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/differentialDownloader/DataSplitter.js:5:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\differentialDownloader'

./electron/node_modules/electron-updater/out/differentialDownloader/DataSplitter.js:6:17-34 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\differentialDownloader'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/differentialDownloader/DifferentialDownloader.js:6:13-26 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\differentialDownloader'

./electron/node_modules/electron-updater/out/differentialDownloader/FileWithEmbeddedBlockMapDifferentialDownloader.js:6:15-30 - Error: Module not found: Error: Can't resolve 'zlib' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\differentialDownloader'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/differentialDownloader/ProgressDifferentialDownloadCallbackTransform.js:4:17-34 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\differentialDownloader'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/providers/PrivateGitHubProvider.js:6:13-28[0m - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out\providers'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js:5:24-48 - Error: Module not found: Error: Can't resolve 'child_process' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

./electron/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js:6:11-24 - Error: Module not found: Error: Can't resolve 'os' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-updater\out'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-window-state/index.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-window-state'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-window-state/node_modules/jsonfile/index.js:5:8-21 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-window-state\node_modules\jsonfile'

./electron/node_modules/electron-window-state/node_modules/mkdirp/index.js:1:11-26 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-window-state\node_modules\mkdirp'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/electron-window-state/node_modules/mkdirp/index.js:2:9-22 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\electron-window-state\node_modules\mkdirp'

./electron/node_modules/glob-parent/index.js:4:23-52 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\glob-parent'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/glob-parent/index.js:5:14-36 - Error: Module not found: Error: Can't resolve 'os' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\glob-parent'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/graceful-fs/graceful-fs.js:1:9-22 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\graceful-fs'

./electron/node_modules/graceful-fs/graceful-fs.js:87:6-29 - Error: Module not found: Error: Can't resolve 'assert' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/graceful-fs/legacy-streams.js:1:13-37 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/graceful-fs/polyfills.js:1:16-36 - Error: Module not found: Error: Can't resolve 'constants' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/is-binary-path/index.js:2:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\is-binary-path'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/jsonfile/index.js:5:8-21 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\jsonfile'

./electron/node_modules/picomatch/lib/constants.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\picomatch\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/picomatch/lib/picomatch.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\picomatch\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

m./electron/node_modules/picomatch/lib/utils.js:3:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\picomatch\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/readdirp/index.js:3:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\readdirp'

./electron/node_modules/readdirp/index.js:4:21-38 - Error: Module not found: Error: Can't resolve 'stream' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\readdirp'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/node_modules/readdirp/index.js:5:16-31 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\node_modules\readdirp'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./node_modules/@capacitor-community/electron/dist/core/index.js:1:1122-1135 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\node_modules\@capacitor-community\electron\dist\core'

./node_modules/@capacitor-community/electron/dist/core/index.js:1:1168-1183 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\node_modules\@capacitor-community\electron\dist\core'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./node_modules/mime-types/index.js:16:14-37 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\node_modules\mime-types'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

./electron/build/src/setup.js:11:15-30 - Error: Module not found: Error: Can't resolve 'path' in 'C:\Users\ODUNAYO\Desktop\Flutter\newApp\electron\build\src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! newApp@0.0.1 build: ng build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the newApp@0.0.1 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ODUNAYO\AppData\Roaming\npm-cache_logs\2022-01-11T09_47_38_459Z-debug.log

@IT-MikeS kindly help with this.

Thanks

IT-MikeS commented 2 years ago

This seems to be more an issue of trying to use the function in your app and not via the context bridge to the main process. So when you build your app webpack throws a fit trying to package up electron and its dependencies.

ogadepoju commented 2 years ago

@IT-MikeS, Yeah i now understand the cause, but what can be the possible solution to this issue ?

jdgjsag67251 commented 2 years ago

There are two possible fixes here...

Quick and dirty

You could add the following to /electron/src/rt/electron-rt.ts:

// This line should already exist. Add 'shell'.
import { ipcRenderer, contextBridge, shell } from 'electron';

contextBridge.exposeInMainWorld('openExternal', shell.openExternal);

You could simply use it in the browser like this:

openExternal('https://google.com');

This could be dangerous!: https://benjamin-altpeter.de/shell-openexternal-dangers/

Best

The best solution is to add a custom plugin (that checks the input). This is a bit more work, but it is the best solution in the long run. You can find the docs here: https://capacitor-community.github.io/electron/docs/creatingplugins.

jdgjsag67251 commented 2 years ago

I added a pull-request to the default Capacitor plugins repo that adds support for Electron to the AppLauncher plugin: https://github.com/ionic-team/capacitor-plugins/pull/793

ogadepoju commented 2 years ago

There are two possible fixes here...

Quick and dirty

You could add the following to /electron/src/rt/electron-rt.ts:

// This line should already exist. Add 'shell'.
import { ipcRenderer, contextBridge, shell } from 'electron';

contextBridge.exposeInMainWorld('openExternal', shell.openExternal);

You could simply use it in the browser like this:

openExternal('https://google.com');

This could be dangerous!: https://benjamin-altpeter.de/shell-openexternal-dangers/

Best

The best solution is to add a custom plugin (that checks the input). This is a bit more work, but it is the best solution in the long run. You can find the docs here: https://capacitor-community.github.io/electron/docs/creatingplugins.

@jdgjsag67251 thanks for your response, i tried the Quick and Dirty hack, but it didn't work as i keep getting the same error, and i really don't know how to approach that suggested Best Solution

ogadepoju commented 2 years ago

I added a pull-request to the default Capacitor plugins repo that adds support for Electron to the AppLauncher plugin: ionic-team/capacitor-plugins#793

I hope this yield something positive

Saqib92 commented 11 months ago
contextBridge.exposeInMainWorld('openExternal', shell.openExternal);

How to call openExternal() in my page.ts file?? what to import? as i am importing shell form electron its not working.

leobaccili commented 10 months ago
contextBridge.exposeInMainWorld('openExternal', shell.openExternal);

How to call openExternal() in my page.ts file?? what to import? as i am importing shell form electron its not working.

i used this code window['openExternal']() this works

Saqib92 commented 10 months ago
contextBridge.exposeInMainWorld('openExternal', shell.openExternal);

How to call openExternal() in my page.ts file?? what to import? as i am importing shell form electron its not working.

i used this code window['openExternal']() this works

What I did is:

add this code in my electron-rt.ts

contextBridge.exposeInMainWorld('electron', {
  shell: {
    openExternal: shell.openExternal
  }
});

and then called it in my ts as:

window.electron.shell.openExternal('https://google.com')

leobaccili commented 10 months ago

way way better, I will use this option

0xfiraterdem commented 3 months ago

App.jsx

 const handleOpenExternal = (url) => {
    window.electron.openExternal(url);
  };

<div className="menu-item" onClick={() => handleOpenExternal('https://cyberpunkcity.com')}>
      <img src={homeIcon} alt="Home" />
       <span>Website</span>
</div>
<div className="menu-item" onClick={() => handleOpenExternal('https://xoxno.com/collection/CITYNFT-26cded')}>
       <img src={nftIcon} alt="Shop" />
       <span>Shop</span>
</div>

preload.js

const { contextBridge, ipcRenderer, shell } = require('electron');

contextBridge.exposeInMainWorld('electron', {
    download: () => ipcRenderer.invoke('download'),
    verify: () => ipcRenderer.invoke('verify'),
    openExternal: (url) => shell.openExternal(url),
});

Uncaught Error: Cannot read properties of undefined (reading 'openExternal')

I keep getting this error. How can I solve it? What am I doing wrong?