Merged
Conversation
…browser-api Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the webpack build configuration to split browser and native builds into separate configurations, introducing a compile-time IS_BROWSER constant to replace runtime Capacitor.getPlatform() checks. It also adds a build guard to ensure the native build doesn't accidentally include references to browser-specific APIs.
Key changes:
- Split webpack configuration into two separate configs (browser and native) with separate
IS_BROWSERflags - Replace runtime
Capacitor.getPlatform()checks with compile-timeIS_BROWSERconstant across adapters and core files - Add build validation in gulpfile.js to detect browser-api references in native chunks
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.common.js | Restructured to export an array of two configurations (browser and native), each with their own IS_BROWSER definition via DefinePlugin |
| webpack.prod.js | Updated to handle array of configurations using .map() |
| webpack.dev.js | Updated to handle array of configurations using .map() |
| src/ui/plugins/capacitor.js | Replaced Capacitor.getPlatform() check with IS_BROWSER global |
| src/lib/adapters/WebDav.ts | Replaced multiple Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/adapters/NextcloudBookmarks.ts | Replaced Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/adapters/Linkwarden.ts | Replaced Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/adapters/Karakeep.ts | Replaced Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/adapters/GoogleDrive.ts | Refactored authorization flow and replaced most Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/adapters/Git.ts | Replaced Capacitor.getPlatform() check with IS_BROWSER |
| src/lib/Logger.js | Replaced Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/Controller.ts | Replaced Capacitor.getPlatform() checks with IS_BROWSER |
| src/lib/Account.ts | Replaced Capacitor.getPlatform() checks with IS_BROWSER, added conditional imports for offscreen module |
| gulpfile.js | Added webpackCheck() function to validate native build doesn't contain browser-api references, updated HTML generation to handle multiple webpack configs |
| tsconfig.json | Changed TypeScript target from es5 to es6 |
| package.json | Updated babel-loader version constraint and modified browserslist with more specific ES6 support requirements |
| package-lock.json | Dependency version updates reflecting package.json changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…r doesn't match Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.