12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { CapacitorConfig } from '@capacitor/cli';
- import * as fs from 'fs';
- // 读取 package.json 的 version
- const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
- const appVersion = packageJson.version;
- const config: CapacitorConfig = {
- appId: 'com.example.app',
- appName: 'wallet_app',
- webDir: 'dist',
- // 开发服务器配置(热更新用)
- server: {
- url: 'http://192.168.0.59:5173',
- cleartext: true, // 允许HTTP明文通信(仅开发环境)
- allowNavigation: ['*'] // 允许任意URL导航
- },
- // 插件配置
- plugins: {
- SplashScreen: {
- launchShowDuration: 3000,
- launchAutoHide: true,
- backgroundColor: '#ffffffff', // ARGB格式白色背景
- androidScaleType: 'CENTER_CROP',
- showSpinner: false,
- androidSpinnerStyle: 'large',
- iosSpinnerStyle: 'small',
- spinnerColor: '#999999',
- splashFullScreen: true,
- splashImmersive: true,
- androidSplashResourceName: 'splash',
- useDialog: false
- },
- CapacitorAssets: {
- iconBackgroundColor: '#ffffff' // 应用图标背景色
- },
- // 注意:原JSON中嵌套了重复的"plugins"键,已修正
- PushNotifications: {
- presentationOptions: ['badge', 'sound', 'alert']
- },
- VersionSync: {
- version: appVersion, // 直接传递版本号
- },
- },
- // 资源文件配置
- // assets: {
- // splash: {
- // src: 'assets/splash.png', // 启动图路径
- // android: true,
- // ios: true
- // }
- // },
- // iOS专属配置
- ios: {
- scheme: 'App',
- scrollEnabled: true,
- },
- // Android专属配置
- android: {
- allowMixedContent: true, // 允许混合HTTP/HTTPS内容
- useLegacyBridge: true, // 使用旧版桥接(兼容性)
- // 签名证书配置(建议通过环境变量注入敏感信息)
- buildOptions: {
- keystorePath: 'f62.keystore',
- keystoreAlias: 'f62', // // 生成时指定的别名
- keystorePassword: 'LkSvN1Ys', // 从环境变量读取
- keystoreAliasPassword: 'LkSvN1Ys'
- }
- }
- };
- export default config;
|