[Gradle, JS] Make multiple entry points and output for webpack
This commit is contained in:
+11
-2
@@ -207,14 +207,23 @@ data class KotlinWebpackConfig(
|
||||
private fun Appendable.appendEntry() {
|
||||
if (entry == null || outputPath == null) return
|
||||
|
||||
val multiEntryOutput = "${outputFileName!!.removeSuffix(".js")}-[name].js"
|
||||
|
||||
//language=JavaScript 1.8
|
||||
appendln(
|
||||
"""
|
||||
// entry
|
||||
config.entry = ${entry.canonicalPath.jsQuoted()};
|
||||
config.entry = {
|
||||
main: [${entry.canonicalPath.jsQuoted()}]
|
||||
};
|
||||
|
||||
config.output = {
|
||||
path: ${outputPath.canonicalPath.jsQuoted()},
|
||||
filename: ${outputFileName!!.jsQuoted()}
|
||||
filename: (chunkData) => {
|
||||
return chunkData.chunk.name === 'main'
|
||||
? ${outputFileName.jsQuoted()}
|
||||
: ${multiEntryOutput.jsQuoted()};
|
||||
}
|
||||
};
|
||||
|
||||
""".trimIndent()
|
||||
|
||||
Reference in New Issue
Block a user