0

我的反应网络应用程序在 BrowserDevelopmentRun 模式下运行,但 BrowserProductionRun 发生错误导致应用程序无法加载

导致错误的行部分如下所示(exzerpt):

_f4686g$=C.prototype.encodeNullableSerializableValue_f4686g$,vt.prototype.encodeSerializableValue

堆栈跟踪

Uncaught TypeError: Property descriptor must be an object, got undefined
    3829 my-react-web-client.js:2
    3829 my-react-web-client.js:2
    o log$:13
    i hot module replacement:363
    9518 my-react-web-client.js:2
    o log$:13
    i hot module replacement:363
    5325 StringOps.kt:42
    o log$:13
    <anonymous> jsonp chunk loading:484
    <anonymous> jsonp chunk loading:484
    <anonymous> universalModuleDefinition:9
    <anonymous> universalModuleDefinition:10
my-react-web-client.js:2:730473
    ObjectOrReflectDefineProperty self-hosted:2635
    defineProperty self-hosted:2686
    3829 my-react-web-client.js:2
    3829 my-react-web-client.js:2
    o log$:13
    i hot module replacement:363
    9518 my-react-web-client.js:2
    o log$:13
    i hot module replacement:363
    5325 StringOps.kt:42
    o log$:13
    <anonym> jsonp chunk loading:484
    <anonym> jsonp chunk loading:484
    <anonym> universalModuleDefinition:9
    <anonym> universalModuleDefinition:10

构建.gradle

plugins {
    id 'org.jetbrains.kotlin.js' version '1.5.10'
}

repositories {
    mavenCentral()
    maven { url 'https://maven.pkg.jetbrains.space/public/p/kotlin/p/kotlin/kotlin-js-wrappers' }
}

dependencies {
    testImplementation 'org.jetbrains.kotlin:kotlin-test-js'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-react', version: '17.0.2-pre.212-kotlin-1.5.10'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-react-dom', version: '17.0.2-pre.212-kotlin-1.5.10'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-styled', version: '5.3.0-pre.212-kotlin-1.5.10'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-css', version: '1.0.0-pre.212-kotlin-1.5.10'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-redux', version: '4.0.5-pre.212-kotlin-1.5.10'
    implementation group: 'org.jetbrains.kotlin-wrappers', name: 'kotlin-react-redux', version: '7.2.3-pre.212-kotlin-1.5.10'
    implementation 'dev.gitlive:firebase-functions:1.3.1'
    implementation 'dev.gitlive:firebase-auth:1.3.1'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
    implementation 'org.kodein.di:kodein-di-js:7.6.0'
    implementation npm("query-string", "7.0.0")

}

kotlin {
    js(LEGACY) {
        binaries.executable()
        browser {
            commonWebpackConfig {
                cssSupport.enabled = true
            }
        }
    }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile).all {
    kotlinOptions {
        freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
    }
}
4

0 回答 0