fix(hcl2cdk): Improve wasm_exec.js file detection in prebuild script #3913
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue
Fixes #3912
Description
Overview
This pull request addresses compatibility issues with Go 1.24 WebAssembly support in the CDK for Terraform (CDKTF) project. The changes focus on updating the WebAssembly bridge implementation to work with the new entrypoint mechanism introduced in Go 1.24.
Problem Statement
Go 1.24 introduced changes to the WebAssembly entrypoint mechanism that affects how Go WebAssembly modules are initialized in JavaScript environments. The current implementation in CDKTF was designed for Go 1.19+ but needed updates to properly support Go 1.24's new WebAssembly runtime behavior.
Technical Approach
Updated the bridge.ts files in both @cdktf/hcl-tools and @cdktf/hcl2json packages to handle the new Go 1.24 WebAssembly entrypoint
Modified the initialization sequence to properly load and execute the WebAssembly modules with the updated runtime
Updated the prebuild.sh scripts to ensure proper copying of the wasm_exec.js file from the Go installation
Enhanced the build process to handle the new WebAssembly module structure
Ensured backward compatibility with existing Go versions while adding support for Go 1.24
Updated the bridge JavaScript files to handle the new entrypoint mechanism
Design Decisions
Backward Compatibility: The changes are designed to work with both older Go versions (1.19+) and the new Go 1.24, ensuring a smooth transition for users.
Minimal Impact: By focusing only on the WebAssembly entrypoint changes, the modifications have minimal impact on the rest of the codebase and maintain the existing API contracts.
Testing Strategy
Checklist