packages/okam-build/lib/processor/replacement.js
function process(file, options) {
    let content = file.content.toString();
    let {config: rules, logger} = options;

    let result = content;
    try {
        result = doReplacement(content, rules || [], file);
    }
    catch (ex) {
        let tip;
        if (ex === 'devServer') {
            tip = ', please execute `npm run dev:server` script or start with `--server` option';
        }
        logger.error('unknown replacement variable:', ex + (tip || ''));
    }

    return {
        content: result
    };
}
function process(file, options) {
    let content = file.content.toString();
    let {config: rules, logger} = options;

    let result = content;
    try {
        result = doReplacement(content, rules || [], file);
    }
    catch (ex) {
        let tip;
        if (ex === 'devServer') {
            tip = ', please execute `npm run dev:server` script or start with `--server` option';
        }
        logger.error('unknown replacement variable:', ex + (tip || ''));
    }

    return {
        content: result
    };
}
Replacement the file content using the given pattern

@param {Object} file the file to process
@param {Object} options the compile options
@return {{content: string}}