How to use the af-webpack/build.default function in af-webpack

To help you get started, we’ve selected a few af-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 umijs / umi / packages / umi-build-dev / src / plugins / commands / build / index.js View on Github external
const filesGenerator = getFilesGenerator(service, {
        RoutesManager,
        mountElementId: config.mountElementId,
      });
      filesGenerator.generate();

      if (process.env.HTML !== 'none') {
        const HtmlGeneratorPlugin = require('../getHtmlGeneratorPlugin').default(
          service,
        );
        // move html-webpack-plugin to the head, so that other plugins (like workbox-webpack-plugin)
        // which listen to `emit` event can detect assets
        service.webpackConfig.plugins.unshift(new HtmlGeneratorPlugin());
      }

      require('af-webpack/build').default({
        cwd,
        webpackConfig: service.webpackConfig,
        onSuccess({ stats }) {
          debug('Build success');
          if (process.env.RM_TMPDIR !== 'none') {
            debug(`Clean tmp dir ${service.paths.tmpDirPath}`);
            rimraf.sync(paths.absTmpDirPath);
          }
          service.applyPlugins('onBuildSuccess', {
            args: {
              stats,
            },
          });
          debug('Build success end');
        },
        onFail({ err, stats }) {