Skip to main content

Overview

Cpp.js uses the cppjs.config.js file for configuration. Based on the project structure, the configuration file extension can be .js, .mjs, or .cjs. The configuration file is mandatory, and it must define the path to the project. This ensures that the project directory is located, regardless of which package manager or runtime is used.

A minimal configuration file would look like this:

import getDirName from 'cpp.js/src/utils/getDirName.js';

export default {
paths: {
project: getDirName(import.meta.url),
},
};

The configuration object consists of six sections. These are:

AttributeDescription
generalThis object includes general configurations, such as the project name
dependenciesThis array includes the dependencies of the project.
pathsThis object defines paths, such as the project path
extThis object specifies file extensions, including those for header files.
exportThis object includes configurations related to lib generation.
platformThis object includes platform-specific configuration.

tip

You can find the JavaScript file that generates the configuration here.