diff --git a/app.js b/app.js index 138640a..0357d19 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,5 @@ module.exports = app => { - app.config.coreMiddleware.unshift('nuxt') + app.config.coreMiddleware.unshift('nuxtTooL') // onBeforeStart app.beforeStart(async () => { // try { diff --git a/app/extend/application.js b/app/extend/application.js index 5a5e3cd..65f3807 100644 --- a/app/extend/application.js +++ b/app/extend/application.js @@ -3,22 +3,22 @@ const { Nuxt, Builder } = require('nuxt') const NUXT = Symbol('Application#nuxt') const NUXT_BUILD = Symbol('Application#nuxtBuild') -function loadNuxtConfig(config) { - let { nuxt } = config - try { - typeof nuxt === 'string' && (nuxt = require(nuxt)) - } catch (e) { - console.warn('[egg-nuxt-tool] ' + nuxt + ' nuxt config file is not exists') - nuxt = { - // srcDir: path.join(config.baseDir, './client'), - // rootDir: config.baseDir - } - console.warn('[egg-nuxt] default nuxt:', JSON.stringify(nuxt)) - } - // Create development build when calling `egg-bin dev` - // nuxt.dev = config.env === 'local' - return nuxt -} +// function loadNuxtConfig(config) { +// let { nuxt } = config +// try { +// typeof nuxt === 'string' && (nuxt = require(nuxt)) +// } catch (e) { +// console.warn('[egg-nuxt-tool] ' + nuxt + ' nuxt config file is not exists') +// nuxt = { +// // srcDir: path.join(config.baseDir, './client'), +// // rootDir: config.baseDir +// } +// console.warn('[egg-nuxt] default nuxt:', JSON.stringify(nuxt)) +// } +// // Create development build when calling `egg-bin dev` +// // nuxt.dev = config.env === 'local' +// return nuxt +// } // function loadNuxtConfig(config) { // let options = config.nuxt @@ -40,8 +40,8 @@ function loadNuxtConfig(config) { module.exports = { get nuxt() { if (!this[NUXT]) { - // this[NUXT] = new Nuxt(this.config.nuxt) - this[NUXT] = new Nuxt(loadNuxtConfig(this.config)) + this[NUXT] = new Nuxt(this.config.nuxt) + // this[NUXT] = new Nuxt(loadNuxtConfig(this.config)) } return this[NUXT] }, diff --git a/app/middleware/nuxt.js b/app/middleware/nuxtTooL.js similarity index 100% rename from app/middleware/nuxt.js rename to app/middleware/nuxtTooL.js diff --git a/package.json b/package.json index 43998b2..20a45c9 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "2.0.0-beta.1", "packageManager": "pnpm@8.6.3", "eggPlugin": { - "name": "nuxt" + "name": "nuxtTooL" }, "files": [ "app",