[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() {
|
private fun Appendable.appendEntry() {
|
||||||
if (entry == null || outputPath == null) return
|
if (entry == null || outputPath == null) return
|
||||||
|
|
||||||
|
val multiEntryOutput = "${outputFileName!!.removeSuffix(".js")}-[name].js"
|
||||||
|
|
||||||
//language=JavaScript 1.8
|
//language=JavaScript 1.8
|
||||||
appendln(
|
appendln(
|
||||||
"""
|
"""
|
||||||
// entry
|
// entry
|
||||||
config.entry = ${entry.canonicalPath.jsQuoted()};
|
config.entry = {
|
||||||
|
main: [${entry.canonicalPath.jsQuoted()}]
|
||||||
|
};
|
||||||
|
|
||||||
config.output = {
|
config.output = {
|
||||||
path: ${outputPath.canonicalPath.jsQuoted()},
|
path: ${outputPath.canonicalPath.jsQuoted()},
|
||||||
filename: ${outputFileName!!.jsQuoted()}
|
filename: (chunkData) => {
|
||||||
|
return chunkData.chunk.name === 'main'
|
||||||
|
? ${outputFileName.jsQuoted()}
|
||||||
|
: ${multiEntryOutput.jsQuoted()};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|||||||
Reference in New Issue
Block a user