Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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})