diff --git a/lib/build.js b/lib/build.js index b7c2c9cf3d..64b79d3675 100644 --- a/lib/build.js +++ b/lib/build.js @@ -84,6 +84,7 @@ export function options () { if (this.options.build && !Array.isArray(this.options.build.loaders)) extraDefaults.loaders = defaultsLoaders if (this.options.build && !Array.isArray(this.options.build.postcss)) extraDefaults.postcss = defaultsPostcss this.options.build = _.defaultsDeep(this.options.build, defaults, extraDefaults) + /* istanbul ignore if */ if (this.dev && isUrl(this.options.build.publicPath)) { this.options.build.publicPath = defaults.publicPath } diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 67d083887a..73780c0666 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -21,7 +21,7 @@ module.exports = { string: 'Nuxt.js' }, build: { - publicPath: 'https://cdn.nuxtjs.org', + publicPath: '/orion/', analyze: { analyzerMode: 'disabled', generateStatsFile: true diff --git a/test/with-config.test.js b/test/with-config.test.js index 7f00f135e0..13b50b7452 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -31,7 +31,7 @@ test('/ (custom app.html)', async t => { test('/ (custom build.publicPath)', async t => { const { html } = await nuxt.renderRoute('/') - t.true(html.includes('src="https://cdn.nuxtjs.org/vendor.bundle')) + t.true(html.includes('src="/test/orion/vendor.bundle')) }) test('/test/ (router base)', async t => {