cli.js 572 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env node
  2. "use strict";
  3. const importLocal = require("import-local");
  4. const WebpackCLI = require("../lib/webpack-cli").default;
  5. const runCLI = async (args) => {
  6. const cli = new WebpackCLI();
  7. try {
  8. await cli.run(args);
  9. } catch (error) {
  10. cli.logger.error(error);
  11. process.exit(2);
  12. }
  13. };
  14. if (
  15. !process.env.WEBPACK_CLI_SKIP_IMPORT_LOCAL && // Prefer the local installation of `webpack-cli`
  16. importLocal(__filename)
  17. ) {
  18. return;
  19. }
  20. process.title = "webpack";
  21. // eslint-disable-next-line unicorn/prefer-top-level-await
  22. runCLI(process.argv);