Ko

raw JSON →
6.6.7 verified Fri May 01 auth: no javascript

Ko is a CLI tool for building and linting React applications. It uses webpack v5 and esbuild under the hood, providing a zero-config setup with customizable options. Version 6.6.7 is the latest stable release, with active development and a monthly release cadence. Key differentiators include built-in support for TypeScript, Sass/SCSS, Babel, and popular linting tools, as well as integration with the DTStack ecosystem. It is designed to simplify the build process for React projects, similar to Create React App but with more flexibility for advanced configurations.

error ModuleNotFoundError: Module not found: Error: Can't resolve 'ko'
cause ko is not installed or not in node_modules.
fix
Run npm install ko --save-dev.
error Error: ko.config.js is not a valid configuration file
cause Syntax error or missing export in config file.
fix
Ensure ko.config.js exports a valid configuration object: module.exports = { ... }.
error TypeError: Cannot read property 'build' of undefined
cause Importing from ko incorrectly.
fix
Use import { build } from 'ko' or import ko from 'ko' and access ko.build.
error Error: [BABEL] Cannot find module '@babel/core'
cause Missing Babel dependency.
fix
Run npm install @babel/core @babel/preset-env --save-dev.
breaking ko v6.0.0 drops support for webpack v4; projects using webpack v4 must upgrade.
fix Update webpack to v5 or use ko v5.x.
deprecated ko v6.3.0 deprecates 'analyze' command in favor of 'build --analyze'.
fix Replace `ko analyze` with `ko build --analyze`.
gotcha ko uses esbuild for dev server; certain webpack loaders may not work with esbuild and will cause silent failures.
fix Disable esbuild in ko.config.js by setting 'builder: "webpack"'.
gotcha ko enforces 'import type' for TypeScript type imports; using regular import may result in runtime errors in production builds.
fix Use `import type { ... }` for type-only imports.
gotcha ko's default Babel config includes @babel/preset-env which may cause issues with older Node versions.
fix Set Node engine or configure Babel targets in ko.config.js.
gotcha ko caches build artifacts in .ko-cache; clearing this cache can resolve unexpected build errors.
fix Run `npx ko clean` to clear cache.
npm install ko
yarn add ko
pnpm add ko

Shows how to create a new project with ko, start dev server, build for production, and run linting.

// Initialize a new ko project
npx ko init my-app
cd my-app

// Start development server
npx ko dev

// Build for production
npx ko build

// Lint source code
npx ko lint