sam-goodwin / punchcard

Type-safe AWS infrastructure.
Apache License 2.0
507 stars 20 forks source link

Fix broken API Gateway resource mappings. #84

Closed sam-goodwin closed 4 years ago

sam-goodwin commented 4 years ago

Fixes: https://github.com/punchcard/punchcard/issues/63

Moved the creation and mapping of a handler by ID outside of Build into "static" space. Also, now map methods with the Resource's path instead of the construct node ID to de-couple from the CDK's internal ID system - allows us to infer IDs statically without a reference to a constructed Construct instance in Build.

In parallel: Fixed a regression by moving all imports of webpack to a dynamic position within the code compilation process (instead of global to a module). This weird behavior is a hack to remove webpack from the output of itself by then applying the Ignore Plugin:

https://github.com/punchcard/punchcard/blob/6579fc148802310326eec3a5a5ed6f1dc509615d/packages/punchcard/lib/core/app.ts#L21-L23