'use strict'; const gulp = require('gulp'); const build = require('@microsoft/sp-build-web'); build.configureWebpack.mergeConfig({ additionalConfiguration: (generatedConfiguration) => { if (build.getConfig().production) { var basePath = build.writeManifests.taskConfig.cdnBasePath; if (!basePath.endsWith('/')) { basePath += '/'; } generatedConfiguration.output.publicPath = basePath; } else { generatedConfiguration.output.publicPath = "/dist/"; } return generatedConfiguration; } }); build.initialize(gulp);