# Environment
# env
interface BalmEnvObject {
isProd: boolean;
isTest: boolean;
isDev: boolean;
inSSR: boolean;
isMP: boolean; // New in 2.9.0
inDesktopApp: boolean; // New in 3.1.0
}
env: BalmEnvObject
Balm workflow environment variable in Node.js.
- standard
env.isDev
istrue
when runningbalm
env.isProd
istrue
when runningbalm -p
orbalm --production
env.isTest
istrue
when runningbalm -t
orbalm --test
- plus
env.inSSR
istrue
when runningbalm -ssr
orbalm --server
env.isMP
istrue
when runningbalm -mp
orbalm --miniprogram
env.inDesktopApp
istrue
when runningbalm -electron
orbalm --desktop-app
# workspace
workspace: string = process.cwd()
(Absolute path) Make sure any symlinks in the project folder are resolved.
π° For example:
// File: /path/to/workspace/balm.config.js
const path = require('path');
const workspace = path.resolve(__dirname);
module.exports = {
workspace
// Other Options...
};
Tips: Usually no need to set.
# inFrontend
inFrontend: boolean = true
Set project type.
true
for a static HTML projectfalse
for a dynamic language project (e.g. PHP framework)
π° For example:
module.exports = {
inFrontend: true
// Other Options...
};
# useDefaults
useDefaults: boolean = true
Enable balm default tasks.
π° For example:
const config = {
useDefaults: false // Don't start balm default tasks
// Other Options...
};
const api = (mix) => {
// Custom tasks by API
};
module.exports = (balm) => {
return {
config,
api
};
};
π Refer to Custom Task API