Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise((resolve, reject) => {
const time = process.hrtime();
const config = Object.assign(configurators.serve(), {
config: configurators.build(Object.assign({}, settings || {}, { renderers, entryPattern })),
});
// logger.warn('serving', config.config);
webpackServe(config).then(server => {
webpackMessages.built({ time: process.hrtime(time), config: config.config });
const { compiler } = server;
server.on('listening', () => {
logger.info(`${config.config.name} server listening`);
const socket = new WebSocket(`ws://${config.hot.host || 'localhost'}:${config.hot.port}`);
socket.on('open', () => {
resolve({ server, compiler, config, socket });
});
});
});
});
target: `http://127.0.0.1:${armeriaPort}`,
changeOrigin: true,
});
async function proxyToApi(ctx: any, next: any) {
if (
!ctx.request.header[docServiceDebug] &&
!ctx.path.endsWith('specification.json') &&
!ctx.path.endsWith('injected.js')
) {
return next();
}
return proxier(ctx, next);
}
serve(
{},
{
config,
port: 3000,
add: (app, middleware) => {
app.use(proxyToApi);
app.use(historyFallback);
middleware.webpack();
middleware.content();
},
},
)
.then((result) => {
process.on('SIGINT', () => {
result.app.stop();
process.exit(0);
});
};
const options: Options = {
compiler,
host: this.options.devIp,
port: 3030,
add: enhancer,
clipboard: false,
devMiddleware: {
publicPath: `http://${this.options.devIp}:3030/`,
stats: this.statOptions,
},
};
await serve(argv, options);
}
}
async function start() {
const scriptFilename = 'main.js';
const config = getAppWebpackConfig({
path: '/',
filename: scriptFilename,
mode: 'development'
});
const { host = '0.0.0.0' } = argv;
serve({ host }, { config }).then(result => {
const { app } = result;
app.use(async ctx => {
ctx.body = renderIndex({ scriptFilename });
});
});
}
return;
}
if (!user.name) {
printError('Need author.name in package.json to publish');
return;
}
if (!user.email) {
printError('Need author.email in package.json to publish');
return;
}
}
if (finalOptions.watch) {
return serve(
{
logLevel: 'silent'
},
{
config: webpackConfig,
port: finalOptions.port,
add: (app, middleware, finalOptions) => {
app.use(
webpackServeWaitpage(finalOptions, {
title: 'Ignite Dev Server',
theme: 'material'
})
);
app.use(
convert(