File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ const { resolve } = require ( 'path' )
2+ const serveStatic = require ( 'serve-static' )
3+
14module . exports = async function nuxtPWA ( moduleOptions ) {
25 const { nuxt } = this
36 const moduleContainer = this // TODO: remove dependency when module-utils
@@ -41,6 +44,15 @@ module.exports = async function nuxtPWA (moduleOptions) {
4144 }
4245 await require ( `./${ name } /module.js` ) ( nuxt , pwa , moduleContainer )
4346 }
47+
48+ // Serve dist from disk
49+ if ( nuxt . options . dev ) {
50+ const clientDir = resolve ( nuxt . options . buildDir , 'dist/client' )
51+ nuxt . options . serverMiddleware . push ( {
52+ path : nuxt . options . build . publicPath ,
53+ handler : serveStatic ( clientDir )
54+ } )
55+ }
4456}
4557
4658module . exports . meta = require ( '../package.json' )
You can’t perform that action at this time.
0 commit comments