Jiri Bruchanov
11/25/2019, 4:14 PMRoman Artemev [JB]
11/25/2019, 8:37 PMturansky
11/25/2019, 11:46 PMJiri Bruchanov
11/26/2019, 10:19 AMplugins {
id 'org.jetbrains.kotlin.js' version '1.3.60'
}
group 'com.test.kotlinjs'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}
kotlin.target.browser { }
I have just this ^, based on intellij's gradle/kotlinjs template...Jiri Bruchanov
11/26/2019, 10:21 AM./gradlew assemble
will create my js + kotlin.js somewhere in the build folder, but I have a feeling there should be a better way of doing it...Ilya Goncharov [JB]
11/26/2019, 10:25 AMbrowserWebpack
to build bundle via webpack, which is ready to run in browser, and you can use browserRun
to run it with hot reload
For testing in browser, you need to bundle all your dependencies in one js. By default gradle plugin do it for you (via webpack), but you need to declare javascript dependencies in gradle script
Another option, if it is plain js in your project (in resources for example), you need to say for webpack, where it should find your js
If you can share your project, it will simply to explain
But in common words, you can create webpack.conf.d
folder and create plain js for configuring webpack
For example you can use alias
(https://webpack.js.org/configuration/resolve/#resolvealias)
Something like (relative path should be relative with base build/js/packages/<your-module-name>
;(function () {
const path = require('path');
config.resolve = config.resolve || {};
config.resolve.alias = {
dependency: path.resolve(__dirname, 'path/to/dependency.js')
};
}());
Jiri Bruchanov
11/26/2019, 10:31 AMwebpack.conf.d
?
I was trying to figure out how to tell gradle in dependencies
Jiri Bruchanov
11/26/2019, 10:32 AMIlya Goncharov [JB]
11/26/2019, 10:34 AMdependencies
block of gradle scriptJiri Bruchanov
11/26/2019, 10:35 AM