UNPKG

@roots/bud-api

Version:

bud.js core module

14 lines (13 loc) 607 B
import { Bud } from '@roots/bud-framework'; import isUndefined from '@roots/bud-support/isUndefined'; export const devtool = async function (input) { const FALLBACK_SOURCEMAP = this.isDevelopment ? `eval` : `source-map`; if (input instanceof Bud) { this.hooks.on(`build.devtool`, FALLBACK_SOURCEMAP); this.api.logger.log(`bud.devtool:`, `devtool set to`, input); return this; } this.hooks.on(`build.devtool`, !isUndefined(input) ? input : FALLBACK_SOURCEMAP); this.api.logger.log(`bud.devtool`, `devtool set to`, input ?? FALLBACK_SOURCEMAP); return this; };