From 33ec3f113368a5013d99da91346f629c9bd1d629 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Tue, 22 Aug 2023 21:12:34 +0200 Subject: [PATCH] Add assetNames support --- .../java/io/mvnpm/esbuild/model/EsBuildConfig.java | 10 ++++++++++ .../io/mvnpm/esbuild/model/EsBuildConfigBuilder.java | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/java/io/mvnpm/esbuild/model/EsBuildConfig.java b/src/main/java/io/mvnpm/esbuild/model/EsBuildConfig.java index ecd9b1e..cc87109 100644 --- a/src/main/java/io/mvnpm/esbuild/model/EsBuildConfig.java +++ b/src/main/java/io/mvnpm/esbuild/model/EsBuildConfig.java @@ -62,6 +62,8 @@ enum Target { private String entryNames; + private String assetNames; + private final List external = new ArrayList<>(); public boolean isBundle() { @@ -206,6 +208,14 @@ public void setEntryNames(String entryNames) { this.entryNames = entryNames; } + public String getAssetNames() { + return assetNames; + } + + public void setAssetNames(String assetNames) { + this.assetNames = assetNames; + } + public List getExternal() { return external; } diff --git a/src/main/java/io/mvnpm/esbuild/model/EsBuildConfigBuilder.java b/src/main/java/io/mvnpm/esbuild/model/EsBuildConfigBuilder.java index ce38f9f..ccfc1d9 100644 --- a/src/main/java/io/mvnpm/esbuild/model/EsBuildConfigBuilder.java +++ b/src/main/java/io/mvnpm/esbuild/model/EsBuildConfigBuilder.java @@ -26,6 +26,7 @@ private void initDefault() { .sourceMap() .splitting() .entryNames("[name]-[hash]") + .assetNames("assets/[name]-[hash]") .format(EsBuildConfig.Format.ESM) .loader(getDefaultLoadersMap()); } @@ -159,6 +160,11 @@ public EsBuildConfigBuilder entryNames(String template) { return this; } + public EsBuildConfigBuilder assetNames(String assetNames) { + esBuildConfig.setAssetNames(assetNames); + return this; + } + public EsBuildConfig build() { return esBuildConfig; }