How to use the af-webpack/webpack-chain.toString 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 / inspect / index.js View on Github external
const config = service.webpackConfig;

      let res;
      if (args.rule) {
        res = config.module.rules.find(r => r.__ruleNames[0] === args.rule);
      } else if (args.plugin) {
        res = config.plugins.find(p => p.__pluginName === args.plugin);
      } else if (args.rules) {
        res = config.module.rules.map(r => r.__ruleNames[0]);
      } else if (args.plugins) {
        res = config.plugins.map(p => p.__pluginName || p.constructor.name);
      } else {
        res = config;
      }

      const output = webpackChain.toString(res, { verbose });
      console.log(output);
    },
  );