I have a custom NPM library that is designed to be utilized in various CDK applications and AWS accounts.
export class FrontendConstruct extends Construct {
constructor(parent: Construct, id: string, props: FrontendConstructProps) {
super(parent, id);
//create s3 bucket, cloudfront CDN, etc.
Below is an example of how I'm using this library within my CDK app:
import * as ssFE from '@customnpmlibrary/cdk-ss-fe'
export interface stFrontendStackProps extends cdk.StackProps {
/**
* The domain name for the site
*/
readonly domainName: string;
/**
* Source location of the frontend code to deploy
*/
readonly deploymentSource: string;
}
export class stFrontendStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: stFrontendStackProps) {
super(scope, id,props);
new ssFE.FrontendConstruct
(this, 'stfeStack', {
domainname: props.domainName,
deploymentSource: props.deploymentSource
});
}
}
When configuring the app:
import { stFrontendStack } from '../lib/st-frontend-stack';
const app = new cdk.App();
new stFrontendStack(app, 'stFrontend-DEV', {
env: {
account: '1234',
region: 'us-east-1'
},
domainName: 'url.url.com',
deploymentSource:'../dist/stfe'
});
However, when attempting to deploy, I encounter the following error during cdk synth:
Class constructor Construct cannot be invoked without 'new'
Any suggestions or assistance would be greatly appreciated.