@@ -26,9 +26,6 @@ export default function NetlifyCmsModule(moduleOptions) {
26
26
const configManager = new ConfigManager ( this . options , moduleOptions ) ;
27
27
const config = configManager . config ;
28
28
29
- const ADMIN_PATH = config . adminPath ;
30
- const BUILD_DIR = config . buildDir ;
31
-
32
29
// This will be called once when builder started
33
30
this . nuxt . plugin ( "build" , async builder => {
34
31
// This will be run just before webpack compiler starts
@@ -79,7 +76,7 @@ export default function NetlifyCmsModule(moduleOptions) {
79
76
if ( this . options . dev ) {
80
77
// Show a message inside console when the build is ready
81
78
builder . plugin ( "compiled" , async ( ) => {
82
- debug ( `Serving on: ${ ADMIN_PATH } ` ) ;
79
+ debug ( `Serving on: ${ config . adminPath } ` ) ;
83
80
} ) ;
84
81
85
82
// Create webpack dev middleware
@@ -119,10 +116,10 @@ export default function NetlifyCmsModule(moduleOptions) {
119
116
if ( this . options . dev ) {
120
117
// Insert webpackDevMiddleware to serve netlify CMS in development
121
118
this . addServerMiddleware ( {
122
- path : ADMIN_PATH ,
119
+ path : config . adminPath ,
123
120
handler : async ( req , res ) => {
124
121
if ( this . nuxt . renderer . netlifyWebpackDevMiddleware ) {
125
- debug ( `requesting url: ${ Utils . urlJoin ( ADMIN_PATH , req . url ) } ` ) ;
122
+ debug ( `requesting url: ${ Utils . urlJoin ( config . adminPath , req . url ) } ` ) ;
126
123
await this . nuxt . renderer . netlifyWebpackDevMiddleware ( req , res ) ;
127
124
}
128
125
if ( this . nuxt . renderer . netlifyWebpackHotMiddleware ) {
@@ -163,8 +160,8 @@ export default function NetlifyCmsModule(moduleOptions) {
163
160
} else {
164
161
// Statically serve netlify CMS (i.e. .nuxt/dist/admin/) files in production
165
162
this . addServerMiddleware ( {
166
- path : ADMIN_PATH ,
167
- handler : serveStatic ( BUILD_DIR , {
163
+ path : config . adminPath ,
164
+ handler : serveStatic ( config . buildDir , {
168
165
maxAge : "1y" // 1 year in production
169
166
} )
170
167
} ) ;
0 commit comments