next-pwaとfirebase hosting,functionを使ってデプロイを試したのですがエラーは出ないのですが
ホーム画面に追加してそれを開くと下記の画面になります
どうやったらこの画面ではなく実装した画面が開けますか?
一応urlを普通に開いたら動作はします
ホーム画面に追加して開いた時のみこうなります
下記にコード貼っておくので見て欲しいです
firebaseFunctuon.js
const { join } = require('path') const { https } = require('firebase-functions') const { default: next } = require('next') const { parse } = require('url') const express = require('express') const compression = require('compression') const createServer = (app) => { const server = express() const handle = app.getRequestHandler() // Middlewares server.use(compression()) // Serve static files server.use(express.static('public')) server.use(express.static('.next')) server.get('/sw.js', (req, res) => { return app.serveStatic(req, res, join(__dirname, '.next', 'sw.js')) }) server.get('/workbox-*.js', (req, res) => { const { pathname } = parse(req.path, true) return app.serveStatic(req, res, join(__dirname, '.next', pathname)) }) server.get('/manifest.json', (req, res) => { return app.serveStatic(req, res, join(__dirname, 'public', 'manifest.json')) }) server.all(/.(js|json|png|jpg|ico)$/i, (req, res) => { return handle(req, res) }) server.all('*', (req, res) => { return handle(req, res) }) return server } const app = next({ dev: false, conf: { distDir: '.next', }, }) const server = createServer(app) exports.nextjsFunc = https.onRequest(server)
next.config
const withPWA = require('next-pwa') const webpack = require('webpack') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') const { ANALYSE, CONFIG_ENV } = process.env const nextConfig = { // Options for next-pwa (see https://github.com/shadowwalker/next-pwa#configuration) pwa: { register: true, dest: '.next', sw: 'sw.js', }, // buildId, dev, isServer, defaultLoaders, webpack webpack: (config, { dev }) => { if (ANALYSE) { // https://www.npmjs.com/package/webpack-bundle-analyzer config.plugins.push(new BundleAnalyzerPlugin()) } config.plugins.push( // Define global constants which are configured at compile time // https://webpack.js.org/plugins/define-plugin/ new webpack.DefinePlugin({ __CONFIG__: JSON.stringify(CONFIG_ENV), }), ) return config }, } module.exports = withPWA(nextConfig)
firebase.json
{ "hosting": { "public": ".next", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "rewrites": [ { "source": "**", "function": "nextjsFunc" } ] }, "functions": { "source": ".", "predeploy": [ "npm --prefix \"$PROJECT_DIR\" install", "npm --prefix \"$PROJECT_DIR\" run build" ], "runtime": "nodejs10" } }
あなたの回答
tips
プレビュー