Skip to content

Cross dependencies between constructs caused ToolkitCleaner failed to run #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vumdao opened this issue Feb 2, 2022 · 7 comments
Closed

Comments

@vumdao
Copy link
Contributor

vumdao commented Feb 2, 2022

It required @aws-cdk/aws-apigatewayv2-*

Error: Cannot find module '@aws-cdk/aws-apigatewayv2-integrations-alpha'
Require stack:
- /home/jack/workspace/github/test-ToolkitCleaner/node_modules/cloudstructs/lib/slack-events/index.js
- /home/jack/workspace/github/test-ToolkitCleaner/node_modules/cloudstructs/lib/index.js
- /home/jack/workspace/github/test-ToolkitCleaner/src/main.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/jack/workspace/github/test-ToolkitCleaner/node_modules/cloudstructs/src/slack-events/index.ts:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
Subprocess exited with error 1

But I don't see how the ToolkitCleaner needs those modules or where to use them

@jogold
Copy link
Owner

jogold commented Feb 2, 2022

Hey @vumdao

The constructs library has a peer dep on the @aws-cdk/aws-apigatewayv2 packages. Not for the ToolkitCleaner construct but for other ones.

If you add this dependency in your project it should be fine.

@jogold
Copy link
Owner

jogold commented Feb 2, 2022

Or you can deep import:

import { ToolkitCleaner } from 'cloudstructs/lib/toolkit-cleaner'

@jogold
Copy link
Owner

jogold commented Feb 3, 2022

Now with v0.4.9 you can do:

import { ToolkitCleaner } from 'cloudstructs/toolkit-cleaner';

@vumdao
Copy link
Contributor Author

vumdao commented Feb 3, 2022

@jogold not work yet

  "dependencies": {
    "aws-cdk-lib": "^2.10.0",
    "cloudstructs": "0.4.9",
    "constructs": "^10.0.5",
    "dotenv": "^16.0.0",
    "env-var": "^7.1.1"
  },

I see you add ./toolkit-cleaner in exports of package.json but the module was not found when did import { ToolkitCleaner } from 'cloudstructs/toolkit-cleaner';

@jogold
Copy link
Owner

jogold commented Feb 3, 2022

This is the issue... microsoft/TypeScript#33079 (and microsoft/TypeScript#35290)

@jogold
Copy link
Owner

jogold commented Feb 3, 2022

@vumdao use 0.4.11 and for the moment we can only deep import:

import { ToolkitCleaner } from 'cloudstructs/lib/toolkit-cleaner';

@vumdao
Copy link
Contributor Author

vumdao commented Feb 4, 2022

Thanks @jogold it works now

@vumdao vumdao closed this as completed Feb 4, 2022
jogold pushed a commit that referenced this issue Feb 5, 2022
Show deep import example in README.

Fixes #154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants