How to use @angular-devkit/build-angular - 10 common examples

To help you get started, we’ve selected a few @angular-devkit/build-angular 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 just-jeb / electron-angular-native / custom-builders / src / custom-webpack / index.ts View on Github external
(stats, config, logger) => {
    // config.stats contains our own stats settings, added during buildWebpackConfig().
    const json = stats.toJson(config.stats);
    if (verbose) {
      logger.info(stats.toString(config.stats));
    } else {
      logger.info(statsToString(json, config.stats));
    }

    if (stats.hasWarnings()) {
      logger.warn(statsWarningsToString(json, config.stats));
    }
    if (stats.hasErrors()) {
      logger.error(statsErrorsToString(json, config.stats));
    }
  };
github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
// ...event,
      success,
      error,
      baseOutputPath,
      outputPath: baseOutputPath,
      outputPaths: outputPaths && Array.from(outputPaths.values()) || [baseOutputPath],
    } as BrowserBuilderOutput);

    if (!success && useBundleDownleveling) {
      // If using bundle downleveling then there is only one build
      // If it fails show any diagnostic messages and bail
      if (webpackStats && webpackStats.warnings.length > 0) {
        context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));
      }
      if (webpackStats && webpackStats.errors.length > 0) {
        context.logger.error(statsErrorsToString(webpackStats, { colors: true }));
      }

      return finalize(success);
    } else if (success) {
      outputPaths = ensureOutputPaths(baseOutputPath, i18n);

      let noModuleFiles: EmittedFiles[] | undefined;
      let moduleFiles: EmittedFiles[] | undefined;
      let files: EmittedFiles[] | undefined;

      const scriptsEntryPointName = normalizeExtraEntryPoints(
        options.scripts || [],
        'scripts',
      ).map(x => x.bundleName);

      if (isDifferentialLoadingNeeded && options.watch) {
github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
let outputPaths: undefined | Map;

    const finalize = (success: boolean, error?: string) => ({
      // ...event,
      success,
      error,
      baseOutputPath,
      outputPath: baseOutputPath,
      outputPaths: outputPaths && Array.from(outputPaths.values()) || [baseOutputPath],
    } as BrowserBuilderOutput);

    if (!success && useBundleDownleveling) {
      // If using bundle downleveling then there is only one build
      // If it fails show any diagnostic messages and bail
      if (webpackStats && webpackStats.warnings.length > 0) {
        context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));
      }
      if (webpackStats && webpackStats.errors.length > 0) {
        context.logger.error(statsErrorsToString(webpackStats, { colors: true }));
      }

      return finalize(success);
    } else if (success) {
      outputPaths = ensureOutputPaths(baseOutputPath, i18n);

      let noModuleFiles: EmittedFiles[] | undefined;
      let moduleFiles: EmittedFiles[] | undefined;
      let files: EmittedFiles[] | undefined;

      const scriptsEntryPointName = normalizeExtraEntryPoints(
        options.scripts || [],
        'scripts',
github just-jeb / electron-angular-native / custom-builders / src / custom-webpack / index.ts View on Github external
(stats, config, logger) => {
    // config.stats contains our own stats settings, added during buildWebpackConfig().
    const json = stats.toJson(config.stats);
    if (verbose) {
      logger.info(stats.toString(config.stats));
    } else {
      logger.info(statsToString(json, config.stats));
    }

    if (stats.hasWarnings()) {
      logger.warn(statsWarningsToString(json, config.stats));
    }
    if (stats.hasErrors()) {
      logger.error(statsErrorsToString(json, config.stats));
    }
  };
github just-jeb / electron-angular-native / custom-builders / src / custom-webpack / index.ts View on Github external
(stats, config, logger) => {
    // config.stats contains our own stats settings, added during buildWebpackConfig().
    const json = stats.toJson(config.stats);
    if (verbose) {
      logger.info(stats.toString(config.stats));
    } else {
      logger.info(statsToString(json, config.stats));
    }

    if (stats.hasWarnings()) {
      logger.warn(statsWarningsToString(json, config.stats));
    }
    if (stats.hasErrors()) {
      logger.error(statsErrorsToString(json, config.stats));
    }
  };
github storybookjs / storybook / app / angular / src / server / angular-cli_utils.ts View on Github external
export function getAngularCliParts(cliWebpackConfigOptions: any) {
  // eslint-disable-next-line global-require, import/no-extraneous-dependencies
  const ngCliConfigFactory = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');

  try {
    return {
      cliCommonConfig: ngCliConfigFactory.getCommonConfig(cliWebpackConfigOptions),
      cliStyleConfig: ngCliConfigFactory.getStylesConfig(cliWebpackConfigOptions),
    };
  } catch (e) {
    return null;
  }
}
github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
if (fileLoader) {
    if (fileLoader.options) {
      (fileLoader.options as { emitFile: boolean }).emitFile = emitFile;
    } else {
      fileLoader.options = { emitFile: emitFile };
    }
  }

  if (emitFile || !webpackConfig.module) {
    return;
  }

  // fix: avoid extract css files when value is false

  // Determine hashing format.
  const hashFormat = getOutputHashFormat(serverOptions.outputHashing as string);

  const autoprefixer = require('autoprefixer');
  const postcssImports = require('postcss-import');

  const udkPostcssPluginCreator = (loader: webpack.loader.LoaderContext) => [
    postcssImports({
      resolve: (url: string) => (url.startsWith('~') ? url.substr(1) : url),
      load: (filename: string) => {
        return new Promise((resolve, reject) => {
          loader.fs.readFile(filename, (err: Error, data: Buffer) => {
            if (err) {
              reject(err);

              return;
            }
github enten / udk / angular / lib / ng-devkit.ts View on Github external
if (fileLoader) {
    if (fileLoader.options) {
      (fileLoader.options as { emitFile: boolean }).emitFile = value;
    } else {
      fileLoader.options = { emitFile: value };
    }
  }

  if (value || !webpackConfig.module) {
    return;
  }

  // fix: avoid extract css files when value is false

  // Determine hashing format.
  const hashFormat = getOutputHashFormat(serverOptions.outputHashing as string);

  const autoprefixer = require('autoprefixer');
  const postcssImports = require('postcss-import');

  const udkPostcssPluginCreator = (loader: webpack.loader.LoaderContext) => [
    postcssImports({
      resolve: (url: string) => (url.startsWith('~') ? url.substr(1) : url),
      load: (filename: string) => {
        return new Promise((resolve, reject) => {
          loader.fs.readFile(filename, (err: Error, data: Buffer) => {
            if (err) {
              reject(err);

              return;
            }
github storybookjs / storybook / app / angular / src / server / angular-cli_utils.ts View on Github external
export function getAngularCliParts(cliWebpackConfigOptions: any) {
  // eslint-disable-next-line global-require, import/no-extraneous-dependencies
  const ngCliConfigFactory = require('@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs');

  try {
    return {
      cliCommonConfig: ngCliConfigFactory.getCommonConfig(cliWebpackConfigOptions),
      cliStyleConfig: ngCliConfigFactory.getStylesConfig(cliWebpackConfigOptions),
    };
  } catch (e) {
    return null;
  }
}
github BenjaminDobler / ngtron / builders / package / index.js View on Github external
return rxjs_1.from(setup()).pipe(operators_1.switchMap(opt => {
        return browser_1.buildWebpackBrowser(opt.buildOptions, context, {
            webpackConfiguration: util_1.electronBuildWebpackConfigTransformFactory(opt.buildOptions, opt.buildElectronOptions, context)
        });
    }), operators_1.filter((val, index) => index < 1), operators_1.tap(result => {
        // Copy electron main

@angular-devkit/build-angular

Angular Webpack Build Facade

MIT
Latest version published 17 hours ago

Package Health Score

100 / 100
Full package analysis

Popular @angular-devkit/build-angular functions