Commit 8298f95 1 parent 1585947 commit 8298f95 Copy full SHA for 8298f95
File tree 1 file changed +12
-0
lines changed
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
+
1
4
module . exports = async function nuxtPWA ( moduleOptions ) {
2
5
const { nuxt } = this
3
6
const moduleContainer = this // TODO: remove dependency when module-utils
@@ -41,6 +44,15 @@ module.exports = async function nuxtPWA (moduleOptions) {
41
44
}
42
45
await require ( `./${ name } /module.js` ) ( nuxt , pwa , moduleContainer )
43
46
}
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
+ }
44
56
}
45
57
46
58
module . exports . meta = require ( '../package.json' )
You can’t perform that action at this time.
0 commit comments