Fix native crash: bundle @capacitor/core instead of externalizing it
The boot crash guard surfaced the real root cause on-device: TypeError: Failed to resolve module specifier "@capacitor/core" @capacitor/core and @capacitor/camera were marked `external` in the Rollup config, which left bare `import "@capacitor/core"` specifiers in the output bundle. A native WebView has no module resolver for bare specifiers, so boot crashed before React mounted. Fix: remove the INSTALLED Capacitor packages from `external` so their JS API layer is bundled (the native implementation is still injected at runtime via window.Capacitor). Only the four NON-installed packages (@capacitor/app, haptics, keyboard, status-bar) stay external — they are never statically imported (accessed via window.Capacitor.Plugins), so this can't break the build. Bump to 1.0.65. Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
95afd9551f
commit
0a47bb47d2
2 changed files with 11 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "skate-spots",
|
||||
"private": true,
|
||||
"version": "1.0.64",
|
||||
"version": "1.0.65",
|
||||
"type": "module",
|
||||
"homepage": "https://skate-spots.com",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -44,12 +44,17 @@ export default defineConfig(() => ({
|
|||
transformMixedEsModules: true,
|
||||
},
|
||||
rollupOptions: {
|
||||
// Native Capacitor plugins have no JS entry point — they are injected
|
||||
// at runtime by Capacitor on the native side. Exclude them from the bundle.
|
||||
// IMPORTANT: installed Capacitor packages (@capacitor/core, @capacitor/camera)
|
||||
// and the signer plugin MUST be bundled. Their JS API layer is real code that
|
||||
// the WebView needs — the *native* implementation is injected at runtime via
|
||||
// window.Capacitor, but the JS imports have to resolve. Externalizing them
|
||||
// leaves bare `import "@capacitor/core"` specifiers in the output, which a
|
||||
// native WebView cannot resolve → "Failed to resolve module specifier" crash.
|
||||
//
|
||||
// Only the Capacitor packages that are NOT installed are kept external, so a
|
||||
// stray import can't break the build. If one of these is ever added to
|
||||
// package.json, remove it from this list so it gets bundled.
|
||||
external: [
|
||||
'nostr-signer-capacitor-plugin',
|
||||
'@capacitor/camera',
|
||||
'@capacitor/core',
|
||||
'@capacitor/app',
|
||||
'@capacitor/haptics',
|
||||
'@capacitor/keyboard',
|
||||
|
|
|
|||
Loading…
Reference in a new issue