Skip to main content
Version: 6.x

Getting Started

Prerequisites

  • Node.js version: Node.js 14+

Create a React Project in One Line

Your can use CLI to create a React Project with TypeScript.

pnpm create ko
# or
npm create ko
# or
yarn create ko

After waiting a second, you could see Creating project in... in terminal.

And then just going into the folder and install dependencies.

Install ko

You can install ko using npm, yarn or pnpm:

pnpm add ko --save-dev
# or
npm install ko --save-dev
# or
yarn add ko --dev

Polyfills are needed for IE browsers. We recommended core-js and regenerator-runtime for it. And you should install them as dependencies:

pnpm add core-js regenerator-runtime

Configuration

After install ko,you can create an configuration file named ko.config.js for customize ko. And you can specify your own entry and output configurations, for more configuration, please see Configuration ko will help you merge these configs and use them in internal webpack instance. A real world showcase:

module.exports = {
entry: './src/app.tsx',
outputPath: './dist' //Your own output path
serve: {
proxy: PROXY_CONFIG, // Your own proxy config
host: '0.0.0.0',
port: 8084,
},
};

Everyday Commands

Your daily workflow only needs a few ko commands:

ko dev

start a development server that provides live reloading. You can change development server default behaviors via serve configurations.

ko build

bundle files with internal webpack instance, with some built-in loaders and plugins that can speed up build process.