server-renderer
Version:
library of server side render for React
28 lines (27 loc) • 1.16 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
exports.getConfig = () => {
const rootDir = process.cwd();
const defaultConfig = {
rootDir,
isDev: process.env.NODE_ENV === 'development',
port: 3000,
htmlTemplatePath: path_1.default.join(rootDir, 'src/index.html'),
distDir: path_1.default.join(rootDir, 'dist'),
builtHTMLPath: path_1.default.join(rootDir, 'dist/client/index.html'),
serverEntry: path_1.default.resolve(rootDir, 'src/index.tsx'),
publicPath: '/public/',
cleanConsoleOnRebuild: true,
decodeEntities: false,
sassData: undefined,
};
const customConfigPath = path_1.default.resolve(defaultConfig.rootDir, 'ssr.config.js');
if (fs_1.default.existsSync(customConfigPath)) {
const customConfig = require(customConfigPath);
return Object.assign(Object.assign(Object.assign({}, defaultConfig), customConfig), { rootDir });
}
return defaultConfig;
};
;