mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15: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')
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// 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
|
||||
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)
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
module.exports = Core.default ? Core.default : Core
|
||||
|
@ -165,7 +165,7 @@ export default class Builder extends Tapable {
|
||||
if (!templateVars.layouts.default) {
|
||||
await mkdirp(r(this.options.buildDir, 'layouts'))
|
||||
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 --
|
||||
@ -205,7 +205,7 @@ export default class Builder extends Tapable {
|
||||
return {
|
||||
src: customFileExists
|
||||
? customPath
|
||||
: r(__dirname, '../app', file), // Relative to dist
|
||||
: r(this.options.nuxtAppDir, file),
|
||||
dst: file,
|
||||
custom: customFileExists
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ const defaultOptions = {
|
||||
dev: (process.env.NODE_ENV !== 'production'),
|
||||
runBuild: false,
|
||||
buildDir: '.nuxt',
|
||||
nuxtAppDir: process.env.NUXT_APP_DIR || resolve(__dirname, '../app'), // relative to dist
|
||||
build: {
|
||||
analyze: 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 => {
|
||||
const Nuxt = require('../')
|
||||
const rootDir = resolve(__dirname, 'fixtures/with-config')
|
||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||
config.rootDir = rootDir
|
||||
|
Loading…
Reference in New Issue
Block a user