How to use the @angular-devkit/build-webpack.runWebpackDevServer function in @angular-devkit/build-webpack

To help you get started, we’ve selected a few @angular-devkit/build-webpack 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 angular / angular-cli / packages / angular_devkit / build_angular / src / dev-server / index.ts View on Github external
);
      }

      const normalizedOptimization = normalizeOptimization(browserOptions.optimization);
      if (normalizedOptimization.scripts || normalizedOptimization.styles) {
        context.logger.error(tags.stripIndents`
          ****************************************************************************************
          This is a simple server for use in testing or debugging Angular applications locally.
          It hasn't been reviewed for security issues.

          DON'T USE IT FOR PRODUCTION!
          ****************************************************************************************
        `);
      }

      return runWebpackDevServer(webpackConfig, context, { logging: loggingFn }).pipe(
        map(buildEvent => {
          // Resolve serve address.
          const serverAddress = url.format({
            protocol: options.ssl ? 'https' : 'http',
            hostname: options.host === '0.0.0.0' ? 'localhost' : options.host,
            pathname: webpackDevServerConfig.publicPath,
            port: buildEvent.port,
          });

          if (first) {
            first = false;
            context.logger.info(tags.oneLine`
              **
              Angular Live Development Server is listening on ${options.host}:${buildEvent.port},
              open your browser on ${serverAddress}
              **
github angular / angular-cli / packages / angular_devkit / build_angular / src / dev-server / index.ts View on Github external
);
      }

      const normalizedOptimization = normalizeOptimization(browserOptions.optimization);
      if (normalizedOptimization.scripts || normalizedOptimization.styles) {
        context.logger.error(tags.stripIndents`
          ****************************************************************************************
          This is a simple server for use in testing or debugging Angular applications locally.
          It hasn't been reviewed for security issues.

          DON'T USE IT FOR PRODUCTION!
          ****************************************************************************************
        `);
      }

      return runWebpackDevServer(
        webpackConfig,
        context,
        {
          logging: loggingFn,
          webpackFactory: require('webpack') as typeof webpack,
          webpackDevServerFactory: require('webpack-dev-server') as typeof WebpackDevServer,
        },
      ).pipe(
        map(buildEvent => {
          // Resolve serve address.
          const serverAddress = url.format({
            protocol: options.ssl ? 'https' : 'http',
            hostname: options.host === '0.0.0.0' ? 'localhost' : options.host,
            pathname: webpackDevServerConfig.publicPath,
            port: buildEvent.port,
          });
github nrwl / nx / packages / web / src / builders / dev-server / dev-server.impl.ts View on Github external
switchMap(([config, options, serverUrl]) => {
      return runWebpackDevServer(config, context, {
        logging: stats => {
          context.logger.info(stats.toString(config.stats));
        }
      }).pipe(
        map(output => {
          output.baseUrl = serverUrl;
          return output;
        })
      );
    })
  );
github nrwl / nx / packages / web / src / builders / dev-server / dev-server.impl.ts View on Github external
switchMap(([config, options, serverUrl]) => {
      return runWebpackDevServer(config, context, {
        logging: stats => {
          context.logger.info(stats.toString(config.stats));
        },
        webpackFactory: require('webpack'),
        webpackDevServerFactory: require('webpack-dev-server')
      }).pipe(
        map(output => {
          output.baseUrl = serverUrl;
          return output;
        })
      );
    })
  );