I have an NPM library here that will be used across multiple CDK apps and AWS accounts
export class FrontendConstruct extends Construct {
constructor(parent: Construct, id: string, props: FrontendConstructProps) {
super(parent, id);
//creating s3 bucket etc
//create cloudfront cdn
Here is my stack on the cdk app using it
import * as ssFE from '@customnpmlibrary/cdk-ss-fe'
export interface stFrontendStackProps extends cdk.StackProps {
/**
* The domain name for the site to use
*/
readonly domainName: string;
/**
* Location of FE 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
});
}
}
and creating 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'
});
when I go to deploy it I get this: during cdk synth
Class constructor Construct cannot be invoked without 'new'
Any thoughts or help?