How to use webpack-serve - 6 common examples

To help you get started, we’ve selected a few webpack-serve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / SBNext / bundler / src / lib / webpack-as-promised.js View on Github external
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 });
        });
      });
    });
  });
github line / armeria / docs-client / scripts / serve.ts View on Github external
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);
github vanilla / vanilla / build / scripts / Builder.ts View on Github external
});
        };

        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);
    }
}
github skidding / jobs-done / tools / start.js View on Github external
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 });
    });
  });
}
github intuit / Ignite / src / ignite.js View on Github external
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(

webpack-serve

A CLI for webpack-plugin-serve, providing a premier webpack development server

MPL-2.0
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis

Popular webpack-serve functions