kyt uses a simple config file in the root of your repo for specifying different options.
To set up your config, create a kyt.config.js
file in the root of your project,
and export an object with the following options.
NOTE kyt.config.js is not currently transpiled with babel. It supports the same syntax as node 6+.
serverURL
- url for the backend node server. default: http://localhost:3000. ifhasServer
is set tofalse
, then this value is ignoredclientURL
- in development, the url for the client assets server default: http://localhost:3001prototypeURL
- url for the prototyping dev server default: http://localhost:3002debug
- when true, the CLI returns all verbose output default: falseproductionPublicPath
- the public path for assets in the production build. Useful for CDN's default:/
reactHotLoader
- Turns on React Hot Loading default: falsehasServer
- Use a backend node server for build and dev (useful to false this out if you already have a backend) default: truemodifyWebpackConfig
- Callback function for editing kyt's Webpack configs. See more details below.modifyJestConfig
- Callback function for editing kyt's Jest config. See more details below.
In an attempt to gather feedback to set future priorities, we're running a brief user survey asking: what are you using modifyWebpackConfig
for?
modifyWebpackConfig
is an optional callback you can define to edit the Webpack config for each part of development.
This allows you to add new babel-plugins, modify Webpack loaders, etc.
The function is called with two parameters:
baseConfig
The base Webpack config used in the process.options
an object of useful options including the webpackConfig type, ports, and paths. The options object includes an environment and type so you can make changes based on a particular development task.
Define the function in your kyt.config.js
and it will be called as each Webpack file loads.
modifyWebpackConfig: (baseConfig, options) => {
// modify baseConfig based on the options
return baseConfig;
};
NOTE: babel-polyfill is included in the Webpack configs'
entry.main[]
array by default. If you usemodifyWebpackConfig()
to modifyentry.main[]
and you wish to keep using the polyfill, be sure to add the new main entries after the polyfill.
Dev Tip: webpack-merge is a helpful tool for changing and combining Webpack configs.
modifyJestConfig
is an optional callback you can define to edit the Jest config for your tests.
The function is called with one parameter:
baseConfig
The base Jest config that will be used.
modifyJestConfig: baseConfig => {
// modify baseConfig as needed
return baseConfig;
};
NOTE: Currently the base Jest config runs
modifyWebpackConfig()
for you withoptions.environment = "development"
in order to grab the development settings for your app (babel plugins, aliases, etc). See the Jest config recipe for an example use case.
Dev Tip: In some cases you may notice that your Jest configuration doesn't seem to have an affect, this is because Jest has a built-in cache to speed up subsequent test runs. In order to ensure that your configuration changes are reflected, run your tests with the --no-cache flag passed into Jest, like so:
kyt test -- --no-cache
kyt allows developers to specify a different kyt config in dev
and build
commands for the purpose of creating environment specific configurations.
kyt build -C kyt.stage.js
option -C
or --config
takes a configuration path from the root of your project.