JavaScript preprocessor and framework build
Constants#
The values set in Site Setting and Build Settings can be used in the template engine.
| constants | description | node-config key | 
|---|---|---|
IS_PRODUCTION | Whether the build mode is NODE_ENV=production or not | - | 
SITE_TITLE | Site title | title | 
SITE_URL | Site URL | url | 
SITE_AUTHOR | Site author | author | 
SITE_DESCRIPTION | Site description | description | 
SITE_ROOT | Site root path (e.g. /) | siteRoot | 
CONFIG | Reference to below | - | 
If you want to use node-config configuration information other than the available constants, you can use the CONFIG constants.
config/development.yml
Apps.ts
* If you are using TypeScript, please define the type by yourself.
Splitting the common logic#
If two or more files have common logic, extract the common logic and put it in a separate file.
For example, it's useful when you have a library like lodash or jQuery.
You can specify the file name of the common logic.
The extraction file name is specified by Build Settings.
Library visualizer#
Using webpack-visualizer-plugin.
Visualizer build run to mode is "once".
Output is <project>/stats.
Web Worker#
Create a web worker using worker-loader.
example
workers/Worker.ts
Apps.ts