Skip to content
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

Module names/import paths: issue with main.js #3547

Open
pablodmngz98 opened this issue Mar 12, 2024 · 1 comment
Open

Module names/import paths: issue with main.js #3547

pablodmngz98 opened this issue Mar 12, 2024 · 1 comment
Labels
bug/has-workaround A bug with a workaround (may not be elegant) bug Something isn't working cdktf language/typescript

Comments

@pablodmngz98
Copy link

pablodmngz98 commented Mar 12, 2024

Expected Behavior

cdktf path shouldn't change.

Actual Behavior

After upgrading from version 0.19.2 to version 0.20.0 the import path for cdktf has changed in main.js from:

const _cdktf = require("cdktf");

to:

const _cdktf = require("../cdktf");

Error message:

[ERROR] default - node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module '../cdktf'
Require stack:
- /../dist/full-stack/main.js
    [...] {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/../dist/full-stack/main.js'
  ]
}

Steps to Reproduce

  1. npm cache clean --force
  2. rm -rf node_modules
  3. rm package-lock.json
  4. npm install -g cdktf-cli@0.20.0
  5. cdktf get
  6. npm install
  7. cdktf synth

Versions

language: typescript
cdktf-cli: 0.20.0
node: v18.18.2
cdktf: 0.19.2
constructs: null
jsii: null
terraform: 1.7.4
arch: x64
os: linux 6.5.0-25-generic

Providers

gavinbunney/kubectl@undefined (LOCAL) terraform provider version: 1.14.0
http@undefined (LOCAL) terraform provider version: 3.4.2
loafoe/ssh@undefined (LOCAL) terraform provider version: 2.7.0
Mastercard/restapi@undefined (LOCAL) terraform provider version: 1.19.1
paragor/jks@undefined (LOCAL) terraform provider version: 0.8.0
random@undefined (LOCAL) terraform provider version: 3.6.0

@pablodmngz98 pablodmngz98 added bug Something isn't working new Un-triaged issue labels Mar 12, 2024
@pablodmngz98
Copy link
Author

pablodmngz98 commented Mar 12, 2024

Workaround

We change the base url of the .swcrc file.
baseUrl: . --> baseUrl: ./dist

@ansgarm ansgarm added language/typescript cdktf bug/has-workaround A bug with a workaround (may not be elegant) and removed new Un-triaged issue labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/has-workaround A bug with a workaround (may not be elegant) bug Something isn't working cdktf language/typescript
Projects
None yet
Development

No branches or pull requests

2 participants