Fix native build: keep signer plugin external, bundle only @capacitor/core
v1.0.65 fixed the runtime crash (bundling @capacitor/core) but broke the
CAPACITOR_BUILD by also un-externalizing nostr-signer-capacitor-plugin —
which is installed from GitHub with a broken package entry point and
cannot be bundled ("Failed to resolve entry for package").
Correct split:
- BUNDLE @capacitor/core & @capacitor/camera (installed, statically
imported, real JS the WebView needs) — this is the white-screen fix.
- KEEP EXTERNAL nostr-signer-capacitor-plugin — no valid entry point;
only used via a guarded dynamic import() at runtime on native
(try/catch → null on failure), so external is correct and safe.
- KEEP EXTERNAL the four non-installed @capacitor/* plugins.
Verified: built bundle has no bare static @capacitor/core specifier;
signer plugin remains an external dynamic import. Bump to 1.0.66.
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
0a47bb47d2
commit
ac362a9a10
2 changed files with 16 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "skate-spots",
|
"name": "skate-spots",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.65",
|
"version": "1.0.66",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"homepage": "https://skate-spots.com",
|
"homepage": "https://skate-spots.com",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -44,17 +44,23 @@ export default defineConfig(() => ({
|
||||||
transformMixedEsModules: true,
|
transformMixedEsModules: true,
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
// IMPORTANT: installed Capacitor packages (@capacitor/core, @capacitor/camera)
|
// IMPORTANT: @capacitor/core and @capacitor/camera MUST be bundled (they are
|
||||||
// and the signer plugin MUST be bundled. Their JS API layer is real code that
|
// installed, statically imported, and their JS API layer is real code the
|
||||||
// the WebView needs — the *native* implementation is injected at runtime via
|
// WebView needs). Leaving them external emitted a bare `import "@capacitor/core"`
|
||||||
// window.Capacitor, but the JS imports have to resolve. Externalizing them
|
// specifier that a native WebView cannot resolve → white-screen boot crash.
|
||||||
// leaves bare `import "@capacitor/core"` specifiers in the output, which a
|
// They are therefore intentionally ABSENT from this list.
|
||||||
// native WebView cannot resolve → "Failed to resolve module specifier" crash.
|
|
||||||
//
|
//
|
||||||
// Only the Capacitor packages that are NOT installed are kept external, so a
|
// Kept external:
|
||||||
// stray import can't break the build. If one of these is ever added to
|
// - nostr-signer-capacitor-plugin: installed from GitHub with a broken package
|
||||||
// package.json, remove it from this list so it gets bundled.
|
// entry point, so it CANNOT be bundled. It's only ever used via a guarded
|
||||||
|
// dynamic import() at runtime on native (see lib/capacitorAmberSigner.ts,
|
||||||
|
// wrapped in try/catch → returns null on failure), so external is correct
|
||||||
|
// and safe — a resolution failure degrades gracefully instead of crashing.
|
||||||
|
// - @capacitor/app|haptics|keyboard|status-bar: NOT installed and never
|
||||||
|
// statically imported (accessed via window.Capacitor.Plugins), so keeping
|
||||||
|
// them external prevents a stray import from breaking the build.
|
||||||
external: [
|
external: [
|
||||||
|
'nostr-signer-capacitor-plugin',
|
||||||
'@capacitor/app',
|
'@capacitor/app',
|
||||||
'@capacitor/haptics',
|
'@capacitor/haptics',
|
||||||
'@capacitor/keyboard',
|
'@capacitor/keyboard',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue