{"id":15565,"library":"cdkx","title":"CDK Bundler","description":"cdkx is a specialized command-line interface (CLI) tool designed to bundle assets for AWS Cloud Development Kit (CDK) applications. Primarily utilizing `esbuild` for its high performance, it streamlines the process of preparing CDK-managed code and assets for deployment. The current stable version is 1.0.12. This package aims to provide an efficient bundling solution for TypeScript-based AWS CDK projects, making it easier to manage dependencies and optimize deployment artifacts. Its key differentiator lies in its focused approach to integrating `esbuild` directly into the CDK development workflow, offering a simpler alternative for asset bundling compared to configuring `esbuild` manually or relying on broader build tools. While not an official AWS CDK tool, it integrates with `@aws-cdk/core` to provide a tailored bundling experience for CDK constructs.","status":"active","version":"1.0.12","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install cdkx","lang":"bash","label":"npm"},{"cmd":"yarn add cdkx","lang":"bash","label":"yarn"},{"cmd":"pnpm add cdkx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core bundler engine for optimizing CDK assets.","package":"esbuild"},{"reason":"Used for compiling TypeScript source files before bundling. A dev dependency for most projects, but listed here as a primary tool.","package":"typescript"},{"reason":"Provides core AWS CDK constructs and types that the bundler interacts with.","package":"@aws-cdk/core"}],"imports":[{"note":"Primary interaction is via the `cdkx` CLI command. Direct programmatic imports are not the common pattern for this package.","wrong":"import { cdkx } from 'cdkx'","symbol":"cdkx","correct":"npx cdkx bundle [options]"},{"note":"The `bundle` command is the main function exposed by the CLI for processing assets.","symbol":"bundle","correct":"cdkx bundle src/my-lambda.ts --out-dir dist"},{"note":"While `cdkx` has an `index.js` as its `main` entry, its primary intended use is through the CLI. A direct programmatic Node.js API is not explicitly documented for public consumption in the provided context, but a library could potentially import internal functions.","symbol":"Node.js API (hypothetical)","correct":"import { bundleAsset } from 'cdkx';\n// Usage example (API might not be officially exposed or documented for direct use)"}],"quickstart":{"code":"npx cdkx bundle src/lambda/my-function.ts \\\n  --platform=node \\\n  --target=es2020 \\\n  --format=cjs \\\n  --sourcemap \\\n  --bundle \\\n  --out-dir=./cdk.out/assets \\\n  --external:aws-sdk\n\nconsole.log(\"CDK asset bundled successfully to cdk.out/assets\");\n// In a CDK stack:\n// import * as lambda from 'aws-cdk-lib/aws-lambda';\n// import * as path from 'path';\n// new lambda.Function(this, 'MyLambdaFunction', {\n//   runtime: lambda.Runtime.NODEJS_18_X,\n//   handler: 'my-function.handler',\n//   code: lambda.Code.fromAsset(path.join(__dirname, '../../cdk.out/assets'))\n// });","lang":"typescript","description":"Demonstrates how to use the `cdkx` CLI to bundle a TypeScript Lambda function, specifying common `esbuild` options and an output directory for CDK assets."},"warnings":[{"fix":"Before `npm publish`, update `package.json`: `\"private\": false`. After publishing, revert to `\"private\": true` if it's an internal package within a monorepo managed by `lerna`.","message":"When publishing your package, ensure `private` is set to `false` in `package.json`. If `cdkx` is part of a larger `lerna` monorepo where it's typically marked `private` during development, this step is critical before running `npm publish`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consult `esbuild` documentation for advanced features. If `cdkx` doesn't provide a passthrough or specific option, consider using `esbuild` directly for those assets or contributing to `cdkx`.","message":"The `cdkx` tool wraps `esbuild`. For advanced `esbuild` configurations not directly exposed by `cdkx` options, you might need to use `esbuild` directly or contribute features to `cdkx`.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'/core':125 '1.0.12':50 'aim':53 'altern':97 'applic':23 'approach':84 'artifact':76 'asset':16,42,99 'aw':18,64,116,123 'aws-cdk':122 'base':63 'broader':109 'build':110 'bundl':15,58,100,130 'bundler':2 'cdk':1,22,38,65,91,117,124,133 'cdk-manag':37 'cdkx':3 'cli':11 'cloud':19 'code':40 'command':8 'command-lin':7 'compar':101 'configur':103 'construct':134 'current':46 'depend':72 'deploy':44,75 'design':13 'develop':20,92 'differenti':79 'direct':88 'easier':69 'effici':57 'esbuild':26,87,104 'experi':131 'focus':83 'high':29 'integr':86,120 'interfac':10 'javascript':135 'key':78 'kit':21 'lie':80 'line':9 'make':67 'manag':39,71 'manual':105 'offer':94 'offici':115 'optim':74 'packag':52 'perform':30 'prepar':36 'primarili':24 'process':34 'project':66 'provid':55,127 'reli':107 'simpler':96 'solut':59 'special':6 'stabl':47 'streamlin':32 'tailor':129 'tool':12,111,118 'typescript':62 'typescript-bas':61 'util':25 'version':48 'workflow':93","created_at":"2026-04-21T17:58:51.605317+00:00","updated_at":"2026-04-21T17:58:51.605317+00:00","problems":[{"fix":"Before publishing, set `\"private\": false` in `package.json`. Remember to revert it if `cdkx` is part of a monorepo that requires it to be private during local development.","cause":"Attempting to `npm publish` a package with `\"private\": true` in its `package.json`.","error":"Error: This package is private and cannot be published. (code EPRIVATE)"},{"fix":"Ensure `esbuild` is listed in your project's `dependencies` and run `npm install` or `yarn install`.","cause":"The `esbuild` dependency is not correctly installed, or the Node.js environment cannot locate it.","error":"Cannot find module 'esbuild'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"cdkx","cli_version":null,"type":"library","homepage":"https://cdkx.dev","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/cdkx","openapi_spec":null,"status_page":null,"smithery":null,"categories":["aws","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-20","install_tag":null}}