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

feat: support custom esbuild module path #220

Merged
merged 2 commits into from
Aug 14, 2022
Merged

Conversation

mrgrain
Copy link
Owner

@mrgrain mrgrain commented Aug 14, 2022

Fixes #218

This feature is required to unblock users of non-TypeScript languages. It can also be used to set different versions of esbuild for each Construct.

Custom path can be set on CodeProps and TransformerProps per instance:

const props = {
  esbuildModulePath: '/path/to/global/esbuild/module';
}

Alternatively, the path can be set globally using the CDK_ESBUILD_MODULE_PATH environment variable:

CDK_ESBUILD_MODULE_PATH="/path/to/global/esbuild/module" cdk synth

In TypeScript, the property defaults to 'esbuild'.

All other languages will use an automatic "best effort" resolution mechanism. The exact algorithm for this is considered an implementation detail and will change in future as new heuristics are added. Specifically, the package might be installed dynamically to a temporary location. To opt-out of this behavior, set esbuildModulePath prop or CDK_ESBUILD_MODULE_PATH env variable.

Python, Go, .NET and Java should use an absolute path, because the jsii execution environment uses a temporary working directory.

@mrgrain mrgrain force-pushed the esbuild-module-import-path branch 5 times, most recently from db8bdb8 to da3aaa6 Compare August 14, 2022 19:37
@mrgrain mrgrain merged commit 9cc071e into main Aug 14, 2022
@mrgrain mrgrain deleted the esbuild-module-import-path branch August 14, 2022 19:50
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

Successfully merging this pull request may close these issues.

Support different module paths for esbuild
1 participant