diff --git a/lib/build.js b/lib/build.js index 7eb425cf11..f548c28d75 100644 --- a/lib/build.js +++ b/lib/build.js @@ -110,7 +110,7 @@ export async function build () { } } debug(`App root: ${this.srcDir}`) - debug(`Generating .nuxt/${this.options.build.buildNamespace ? (this.options.build.buildNamespace + '/') : ''} files...`) + debug(`Generating ${this.buildDir} files...`) // Create .nuxt/, .nuxt/components and .nuxt/dist folders await remove(r(this.buildDir)) await mkdirp(r(this.buildDir, 'components')) diff --git a/lib/module.js b/lib/module.js index 142c7b7b85..4bd726d085 100755 --- a/lib/module.js +++ b/lib/module.js @@ -52,7 +52,7 @@ class Module { const {dst} = this.addTemplate(template) // Add to nuxt plugins this.options.plugins.push({ - src: '~/.nuxt/' + dst, + src: path.join(this.nuxt.buildDir, dst), ssr: template.ssr }) } diff --git a/lib/nuxt.js b/lib/nuxt.js index 39bc7448d2..64fb633b1b 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -17,6 +17,7 @@ class Nuxt { constructor (options = {}) { const defaults = { dev: true, + buildDir: '.nuxt', env: {}, head: { meta: [], @@ -61,9 +62,6 @@ class Nuxt { watchers: { webpack: {}, chokidar: {} - }, - build: { - buildNamespace: null } } // Sanitization @@ -79,8 +77,7 @@ class Nuxt { // Explicit srcDir, rootDir and buildDir this.dir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd()) this.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(this.dir, options.srcDir) : this.dir) - this.buildDir = (typeof options.build.buildNamespace === 'string' && options.build.buildNamespace) - ? resolve(this.dir, '.nuxt', options.build.buildNamespace) : resolve(this.dir, '.nuxt') + this.buildDir = join(this.dir, options.buildDir) options.rootDir = this.dir options.srcDir = this.srcDir options.buildDir = this.buildDir diff --git a/test/module.test.js b/test/module.test.js index 7938b317f8..d03cce264f 100755 --- a/test/module.test.js +++ b/test/module.test.js @@ -26,7 +26,7 @@ test('Vendor', async t => { }) test('Plugin', async t => { - t.true(nuxt.options.plugins[0].src.startsWith('~/.nuxt/basic.reverse'), 'plugin added to config') + t.true(nuxt.options.plugins[0].src.includes('fixtures/module/.nuxt/basic.reverse.'), 'plugin added to config') const { html } = await nuxt.renderRoute('/') t.true(html.includes('

TXUN

'), 'plugin works') })