Visual Studio Code Setup for Kintone Customization Development
Contents
- Overview
- Preparation
- How It Works
- Steps for Setting up the Development Environment
- 1. Generate a Certificate and Private Key Using the mkcert Tool
- 2. Enable HTTPS on the Live Server Extension
- 3. Launch a Local Development Server Using the Live Server Extension
- 4. Set the localhost URLs with HTTPS in the Kintone App's Settings
- 5. Refresh the Browser to Load and Apply the Latest Customization File
- Steps for Webpack Projects
Overview
This article introduces how to instantly reflect local customization code changes to the Kintone App using
Visual Studio Code (VS Code)
and the
Live Server extension
. With this setup, developers can remove the need to manually upload customization files to the Kintone App when developing JavaScript customizations.
Preparation
The following tools are used in this setup:
-
Visual Studio Code
(VS Code) editor
-
Live Server
VS Code extension
-
mkcert
command-line tool that generates locally-trusted development certificates
Install VS Code and the Live Server extension on the local device.
How It Works
The following processes occur when syncing the local code with a Kintone App.
- The Kintone customization project is opened in VS Code
- The files are hosted locally using the Live Server extension
- HTTPS is enabled on the local development server using the mkcert command-line tool
- The localhost URLs are set in the Kintone App's settings
- Kintone actively fetches the JavaScript and CSS files from the localhost
Attention
Only HTTPS can be registered in the URL for Kintone customization. Due to this requirement, HTTPS must be enabled on the Live Server.
Steps for Setting up the Development Environment
The following are the key steps in setting up the Kintone customization development environment:
- Generate a certificate and private key using the mkcert tool
- Enable HTTPS on the Live Server extension
- Launch a local development server using the Live Server extension
- Set the localhost URLs in the Kintone App's settings
- Refresh the browser to load and apply the latest customization files
Note
For Webpack setup, additional steps are required.
For more information, refer to the
Steps for Webpack Projects
section.
1. Generate a Certificate and Private Key Using the mkcert Tool
This step covers installing, initializing, and using the mkcert command-line tool to generate a valid certificate and private key for https://localhost
access.
As of March 2025, v1.4.4
is the latest version of mkcert.
For macOS, install mkcert using
Homebrew
.
|
|
For Windows, install mkcert using
Chocolatey
.
|
|
Initialize mkcert to install a local
certificate authority (CA)
.
When prompted for a password, input the device password.
Click Yes when a security warning appears.
|
|
Generate a certificate and private key for localhost.
|
|
The following files are generated:
localhost+2-key.pem
(the private key)localhost+2.pem
(the certificate)
Note
- mkcert supports Windows, macOS, and Linux.
For more information, refer to the mkcert's Installationdocumentation.
- When downloading mkcert from GitHub, make sure to run the installation commands in the directory where mkcert is located.
Warning
The certificate and private key are for development purposes only and should not be shared with others.
2. Enable HTTPS on the Live Server Extension
This step enables the Live Server extension's HTTPS mode and configures the settings to use the certificate and private key generated in the previous step.
Follow these steps to enable Live Server extension's HTTPS mode:
- Open the
VS Code Command Palette
- Type and select
Preferences: Open Settings (UI)
- In the settings search bar, type
liveServer.settings.https
- Set the
enable
property totrue
- Set the
cert
property to the path of the certificate generated in the previous step - Set the
key
property to the path of the private key generated in the previous step
The Live Server extension's HTTPS setting should look like the following screenshot:
Live Server extension's HTTPS mode can also be enabled through VS Code's
User and Workspace Settings
by appending the following JSON to the
.vscode/settings.json
file.
For Windows
|
|
For Mac
|
|
Warning
Be careful when modifying the settings.json
file since it holds all of the VS Code settings.
VS Code may not work properly if the file is not configured correctly.
3. Launch a Local Development Server Using the Live Server Extension
To launch the local development server:
- Open the Kintone customization project in VS Code
- Open the
VS Code Command Palette
- Type and select
Live Server: Open With Live Server
- Navigate to
https://localhost:5500
on the web browser to access the server
The project directory will be accessible via the browser.
Accessing https://localhost:5500
should look like the below image.
Navigate to the JavaScript and CSS files.
4. Set the localhost URLs with HTTPS in the Kintone App's Settings
To get the localhost URL with HTTPS for a file:
- Navigate to the file hosted on the local development server via the browser
- Copy the URL from the browser's address bar
- Navigate to the Kintone App's
JavaScript and CSS Customization settings
- Set the localhost URL with HTTPS to the desired option
-
- Click on Save and then the Update App buttons
The setup for the optimized Kintone customization development environment is now complete.
5. Refresh the Browser to Load and Apply the Latest Customization File
Modify a Kintone customization file and manually refresh the browser displaying the Kintone App.
The Kintone App will load and apply the customization file with the latest changes.
Attention
This is only a development environment setup.
The changes are only implemented on other devices once the code is uploaded to the Kintone App.
Note
If other users want to verify the changes as the code is being developed, consider using the customize-uploader CLI tool.
Steps for Webpack Projects
Webpack is a module bundler that is helpful when building a complex Kintone customization project with multiple files and dependencies. Projects built with frameworks like React also require a bundler like Webpack to have all the JavaScript files bundled into a single file.
Since Webpack can watch files and recompile whenever they change with the
watch
option, the setup differs.
To set up the optimized Kintone customization development environment for Webpack projects:
-
Build Webpack with the watch option
1
npx webpack --mode development --colors --watch
-
Access
https://localhost:5500
and copy the file's URL for the build artifact set inwebpack.config.js
. -
Set the URL in the Kintone App's JavaScript and CSS Customization settings
.
Note
webpack-dev-server
can also host files locally with HTTPS mode. For more information, refer to their
development guide
.