How to use the next-server/next-config.default function in next-server

To help you get started, we’ve selected a few next-server 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 zeit / next.js / packages / next-build / index.js View on Github external
module.exports = async function build({dir, conf, entrypoint, buildid: passedBuildId}) {
  const config = loadConfig(PHASE_PRODUCTION_BUILD, dir, conf)
  const buildId = passedBuildId || await config.generateBuildId().trim() // defaults to a uuid
  const distDir = path.join(dir, config.distDir)

  try {
    await access(dir, (fs.constants || fs).W_OK)
  } catch (err) {
    console.error(`> Failed, build directory is not writeable. https://err.sh/zeit/next.js/build-dir-not-writeable`)
    throw err
  }

  const Bundle = require('parcel/src/Bundle')
  rewriteFileName(Bundle, buildId)

  const Bundler = require('parcel');

  await serverBundler({Bundler, dir, buildId, config, entrypoint})