mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-17 17:57:13 +00:00
use nuxtAppDir
This commit is contained in:
parent
45485f5b8a
commit
8f2945111a
11
index.js
11
index.js
@ -14,14 +14,13 @@ require('source-map-support').install();
|
|||||||
|
|
||||||
const Core = require('./dist/core.js')
|
const Core = require('./dist/core.js')
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// Use special env flag to specify app dir without modify builder
|
||||||
|
if (!process.env.NUXT_APP_DIR) {
|
||||||
|
process.env.NUXT_APP_DIR = path.resolve(__dirname, 'app')
|
||||||
|
}
|
||||||
|
|
||||||
// Polyfill Builder into Core
|
// Polyfill Builder into Core
|
||||||
const Builder = require('./dist/builder')
|
const Builder = require('./dist/builder')
|
||||||
// Use special env flag to specify app dir without modify builder
|
|
||||||
if (!process.env.NUXT_APP_TEMPALTE_DIR) {
|
|
||||||
process.env.NUXT_APP_TEMPALTE_DIR = path.resolve(__dirname, 'app')
|
|
||||||
}
|
|
||||||
Object.assign(Core, Builder)
|
Object.assign(Core, Builder)
|
||||||
// ------------------------------------------------------------------
|
|
||||||
|
|
||||||
module.exports = Core.default ? Core.default : Core
|
module.exports = Core.default ? Core.default : Core
|
||||||
|
@ -165,7 +165,7 @@ export default class Builder extends Tapable {
|
|||||||
if (!templateVars.layouts.default) {
|
if (!templateVars.layouts.default) {
|
||||||
await mkdirp(r(this.options.buildDir, 'layouts'))
|
await mkdirp(r(this.options.buildDir, 'layouts'))
|
||||||
templatesFiles.push('layouts/default.vue')
|
templatesFiles.push('layouts/default.vue')
|
||||||
templateVars.layouts.default = r(__dirname, 'app', 'layouts', 'default.vue')
|
templateVars.layouts.default = r(this.options.nuxtAppDir, 'layouts', 'default.vue')
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Routes --
|
// -- Routes --
|
||||||
@ -205,7 +205,7 @@ export default class Builder extends Tapable {
|
|||||||
return {
|
return {
|
||||||
src: customFileExists
|
src: customFileExists
|
||||||
? customPath
|
? customPath
|
||||||
: r(__dirname, '../app', file), // Relative to dist
|
: r(this.options.nuxtAppDir, file),
|
||||||
dst: file,
|
dst: file,
|
||||||
custom: customFileExists
|
custom: customFileExists
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ const defaultOptions = {
|
|||||||
dev: (process.env.NODE_ENV !== 'production'),
|
dev: (process.env.NODE_ENV !== 'production'),
|
||||||
runBuild: false,
|
runBuild: false,
|
||||||
buildDir: '.nuxt',
|
buildDir: '.nuxt',
|
||||||
|
nuxtAppDir: process.env.NUXT_APP_DIR || resolve(__dirname, '../app'), // relative to dist
|
||||||
build: {
|
build: {
|
||||||
analyze: false,
|
analyze: false,
|
||||||
extractCSS: false,
|
extractCSS: false,
|
||||||
|
@ -106,7 +106,6 @@ test.after('Closing server and nuxt.js', t => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test.after('Should be able to start Nuxt with build done', async t => {
|
test.after('Should be able to start Nuxt with build done', async t => {
|
||||||
const Nuxt = require('../')
|
|
||||||
const rootDir = resolve(__dirname, 'fixtures/with-config')
|
const rootDir = resolve(__dirname, 'fixtures/with-config')
|
||||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||||
config.rootDir = rootDir
|
config.rootDir = rootDir
|
||||||
|
Loading…
Reference in New Issue
Block a user