This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle
67 lines (55 loc) · 1.8 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import groovy.json.StringEscapeUtils
plugins {
id 'org.jetbrains.kotlin.js'
}
repositories {
jcenter()
}
dependencies {
implementation project(":common")
testImplementation Libs.kotlinTestJs
implementation Libs.kotlinxHtmlJs
implementation Libs.kotlinxCoroutinesCoreCommon
implementation Libs.kotlinExtensions
implementation Libs.kotlinReact
implementation Libs.kotlinReactDom
implementation npm('react', Versions.react)
implementation npm('react-dom', Versions.react)
// https://github.com/JetBrains/kotlin-wrappers/issues/109
implementation npm("core-js", "3")
// https://github.com/ktorio/ktor/issues/961
implementation npm("text-encoding", "*")
implementation(npm("abort-controller", "3.0.0"))
// devDependencies but no dsl
implementation devNpm("webpack", "4.42.1")
implementation devNpm("babel-loader", "8")
implementation devNpm("@babel/core", "7")
implementation devNpm("@babel/preset-env", "7")
implementation devNpm("css-loader", "*")
implementation devNpm("style-loader", "*")
implementation devNpm("html-loader", "*")
implementation devNpm("source-map-loader", "*")
implementation devNpm("karma", "*")
}
kotlin {
target {
browser {
webpackTask {
doFirst {
def path = StringEscapeUtils.escapeJavaScript(file("src/main/resources").absolutePath)
file("webpack.config.d/resources.js").text = "config.resolve.modules.push('$path');"
}
}
}
}
}
compileKotlinJs {
kotlinOptions {
metaInfo = true
outputFile = "$project.buildDir.path/js/${project.name}.js"
sourceMap = true
sourceMapEmbedSources = "always"
moduleKind = 'commonjs'
main = "call"
}
}