Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Merge options with static webpack configs
clientConfig = merge.smart(baseConfig(clientOptions), clientConfig(clientOptions));
serverConfig = merge.smart(baseConfig(serverOptions), serverConfig(serverOptions));
// Modify via userland config
try {
clientConfig = config.modifyWebpackConfig(clone(clientConfig), clientOptions);
serverConfig = config.modifyWebpackConfig(clone(serverConfig), serverOptions);
} catch (error) {
logger.error('Error in your kyt.config.js modifyWebpackConfig():', error);
process.exit(1);
}
if (config.debug) {
logger.debug('Client webpack configuration:', clientConfig);
logger.debug('\n\n');
logger.debug('Server webpack configuration:', serverConfig);
}
// A "main" entry is required in the server config.
if (!serverConfig.entry.main) {
logger.error(
'A main entry is required in the server configuration. Found: ',
serverConfig.entry
);
process.exit(1);
}
return {
clientConfig,
serverConfig,
clientConfig = merge.smart(baseConfig(clientOptions), clientConfig(clientOptions));
serverConfig = merge.smart(baseConfig(serverOptions), serverConfig(serverOptions));
// Modify via userland config
try {
clientConfig = config.modifyWebpackConfig(clone(clientConfig), clientOptions);
serverConfig = config.modifyWebpackConfig(clone(serverConfig), serverOptions);
} catch (error) {
logger.error('Error in your kyt.config.js modifyWebpackConfig():', error);
process.exit(1);
}
if (config.debug) {
logger.debug('Client webpack configuration:', clientConfig);
logger.debug('\n\n');
logger.debug('Server webpack configuration:', serverConfig);
}
// A "main" entry is required in the server config.
if (!serverConfig.entry.main) {
logger.error(
'A main entry is required in the server configuration. Found: ',
serverConfig.entry
);
process.exit(1);
}
return {
clientConfig,
serverConfig,
};
};
// Merge options with static webpack configs
clientConfig = merge.smart(baseConfig(clientOptions), clientConfig(clientOptions));
serverConfig = merge.smart(baseConfig(serverOptions), serverConfig(serverOptions));
// Modify via userland config
try {
clientConfig = config.modifyWebpackConfig(clone(clientConfig), clientOptions);
serverConfig = config.modifyWebpackConfig(clone(serverConfig), serverOptions);
} catch (error) {
logger.error('Error in your kyt.config.js modifyWebpackConfig():', error);
process.exit(1);
}
if (config.debug) {
logger.debug('Client webpack configuration:', clientConfig);
logger.debug('\n\n');
logger.debug('Server webpack configuration:', serverConfig);
}
// A "main" entry is required in the server config.
if (!serverConfig.entry.main) {
logger.error(
'A main entry is required in the server configuration. Found: ',
serverConfig.entry
);
process.exit(1);
}
return {
clientConfig,
serverConfig,
};
const startPrototype = () => {
// Build webpack config
let webpackConfig = merge.smart(baseConfig(options), protoConfig(options));
webpackConfig = config.modifyWebpackConfig(webpackConfig, options);
// Preparing prototype compiler
let compiler = null;
try {
if (config.debug) logger.debug('Prototype Config', webpackConfig);
compiler = webpack(webpackConfig);
} catch (error) {
logger.error('Webpack config is invalid\n', error);
process.exit();
}
// Creates a webpack dev server at the specified port
server = new WebpackDevServer(compiler, webpackConfig.devServer);
server.listen(prototypeURL.port, prototypeURL.hostname, () => {
logger.end(`webpack-dev-server ${prototypeURL.href}prototype`);
});
};
logger.start('Configuring Prototype...');