【发布时间】:2020-11-22 12:01:13
【问题描述】:
我在这里有一个 NPM 库,将用于多个 CDK 应用程序和 AWS 账户
export class FrontendConstruct extends Construct {
constructor(parent: Construct, id: string, props: FrontendConstructProps) {
super(parent, id);
//creating s3 bucket etc
//create cloudfront cdn
这是我在使用它的 cdk 应用程序上的堆栈
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
});
}
}
并创建应用程序
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'
});
当我去部署它时,我得到了这个:在 cdk 合成器期间
Class constructor Construct cannot be invoked without 'new'
有什么想法或帮助吗?
【问题讨论】:
标签: typescript aws-cdk