taso
02/02/2018, 12:54 PMreact
project with KotlinJs. https://github.com/novoda/spikes/blob/master/game-of-life-multiplatform/web/build.gradle
The below gradle script is something we copy pasted. When I upgrade to Kotlin version 1.2.21
, the task mentioned in the very bottom copyDependenciesKotlinJs
is gone. Since I don’t understand the setup, I’m really not sure how to fix it.
task copyStatic(type: Copy) {
from "$rootDir/src/web"
into "$buildDir/web"
}
task buildBundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) {
args = ["run", "dist"]
}
task copyKotlinJs(type: Copy, dependsOn: compileKotlin2Js) {
def workDir = "$buildDir/classes/main/"
from(workDir) {
include "*.js"
include "*.js.map"
}
into "$workDir/dependencies"
}
task devBuild(dependsOn: [npmInstall, copyStatic, copyKotlinJs])
assemble.dependsOn buildBundle, copyStatic
afterEvaluate {
copyKotlinJs.dependsOn copyDependenciesKotlinJs
}
Tristan Caron
02/02/2018, 1:40 PManton.bannykh
02/02/2018, 3:52 PManton.bannykh
02/02/2018, 3:53 PManton.bannykh
02/02/2018, 3:53 PManton.bannykh
02/02/2018, 3:54 PMtask buildBundle(type: NpmTask, dependsOn: [npmInstall, runDceKotlinJs]) {
args = ["run", "dist"]
}
task devBuild(dependsOn: [npmInstall, runDceKotlinJs]) {
runDceKotlinJs.dceOptions.devMode = true
}
task copyStatic(type: Copy) {
from "$projectDir/src/web"
into "$buildDir/web"
}
assemble.dependsOn buildBundle, copyStatic
anton.bannykh
02/02/2018, 3:55 PMvar path = require("path");
module.exports = {
entry: path.resolve(__dirname, "src/main/js/index.js"),
output: {
path: path.resolve(__dirname, "build/web"),
filename: "bundle.js"
},
resolve: {
modules: [path.resolve(__dirname, "node_modules"), path.resolve(__dirname, "build/kotlin-js-min/main/")]
},
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
}
]
}
};
anton.bannykh
02/02/2018, 3:56 PMvar webpack = require("webpack");
var merge = require("webpack-merge");
var path = require("path");
module.exports = merge({
devtool: "inline-source-map",
resolve: {
modules: [path.resolve(__dirname, "build/kotlin-js-min/main")]
},
devServer: {
contentBase: "./src/web/"
// port: 9000,
// hot: true,
// proxy: [
// {
// context: ["/all", "/sessions"],
// target: "<http://localhost:8080>",
// ws: true
// }
// ]
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
},require("./webpack.common.js"));
anton.bannykh
02/02/2018, 3:56 PManton.bannykh
02/02/2018, 3:57 PMtaso
02/02/2018, 5:01 PMtaso
02/02/2018, 5:01 PManton.bannykh
02/02/2018, 5:35 PMtaso
02/09/2018, 4:14 PMtaso
02/09/2018, 4:14 PMcommon-js
which uses multiplatform project. Then have a regular kotlin2js
depending on common-js