'use strict';

const index$1 = require('./index2.cjs');
const cjs = require('./cjs.cjs');
const index = require('./index.cjs');
require('path');
require('tty');

const build = index.defineNuxtCommand({
  meta: {
    name: "build",
    usage: "npx nuxi build [rootDir]",
    description: "Build nuxt for production deployment"
  },
  async invoke(args) {
    process.env.NODE_ENV = process.env.NODE_ENV || "production";
    const rootDir = index$1.resolve(args._[0] || ".");
    const { loadNuxt, buildNuxt } = cjs.requireModule("@nuxt/kit", rootDir);
    const nuxt = await loadNuxt({ rootDir });
    nuxt.hook("error", (err) => {
      index.error("Nuxt Build Error:", err);
      process.exit(1);
    });
    await buildNuxt(nuxt);
  }
});

exports["default"] = build;
