From 27ffe2f2693c95271e0cf5ce5fd5d509989a3b92 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Thu, 9 May 2024 08:22:16 +0930 Subject: [PATCH] reorder custom behaviors to be evaluated before other static mappings --- packages/static-hosting/lib/static-hosting.ts | 10 +++++----- packages/static-hosting/package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/static-hosting/lib/static-hosting.ts b/packages/static-hosting/lib/static-hosting.ts index 5c3eac5d..04e72a2b 100644 --- a/packages/static-hosting/lib/static-hosting.ts +++ b/packages/static-hosting/lib/static-hosting.ts @@ -478,6 +478,11 @@ export class StaticHosting extends Construct { const additionalBehaviors: Record> = {}; + // If additional behaviours are provided via props, then merge, overriding generated behaviours if required. + if (props.additionalBehaviors) { + Object.assign(additionalBehaviors, props.additionalBehaviors); + } + if (props.backendHost) { backendOrigin = new HttpOrigin(props.backendHost); @@ -525,11 +530,6 @@ export class StaticHosting extends Construct { } } - // If additional behaviours are provided via props, then merge, overriding generated behaviours if required. - if (props.additionalBehaviors) { - Object.assign(additionalBehaviors, props.additionalBehaviors); - } - const distributionProps: DistributionProps = { domainNames: domainNames, webAclId: props.webAclArn, diff --git a/packages/static-hosting/package.json b/packages/static-hosting/package.json index 17a52860..ecda9659 100644 --- a/packages/static-hosting/package.json +++ b/packages/static-hosting/package.json @@ -1,6 +1,6 @@ { "name": "@aligent/cdk-static-hosting", - "version": "2.0.0", + "version": "2.3.1", "main": "index.js", "license": "GPL-3.0-only", "homepage": "https://github.com/aligent/aws-cdk-static-hosting-stack#readme",