You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is webpack absolutely necessary for this to run? It does't seem like any of this code would run client side (I hope, unless I am misunderstanding it). I started with the glitch examples in this project. I wanted to connect a firebase database but kept getting errors when trying to install the firebase-admin package. After a lot of research it seems like firebase-admin isn't compatible with webpack, I guess since it is supposed to be back-end only.
Here's my code. It's just the glitch example with firebase thrown at the top. It throws a million errors about "Field 'browser' doesn't contain a valid alias configuration"
const firebase = require('firebase-admin')
import proxy from '@fly/proxy'
// the Glitch App URL
const glitchHost = "fly-example.glitch.me"
/* Deployment instructions */
// fly apps create <app-name>
// fly deploy
// fly hostnames add <your-custom-hostname.com>
// create a proxy fetch function to Glitch
const glitch = proxy(`https://${glitchHost}`,
{
headers: {
'host': glitchHost, // set HOST header to glitchHost
'x-forwarded-host': false // Don't send x-forwarded-host header
}
})
fly.http.respondWith(function (req) {
// redirect to https
let resp = requireSSL(req)
if (resp) return resp
// proxy to glitch
return glitch(req)
})
function requireSSL(req) {
const url = new URL(req.url)
if (url.protocol != "https:") {
url.protocol = "https"
url.port = '443'
if (app.env === "development") {
console.log("Skipping SSL redirect in dev mode:", url.toString())
} else {
return new Response("Redirecting", {
status: 301,
headers: { "Location": url.toString() }
})
}
}
}
I tried having webpack just skip that require using __non_webpack_require__("firebase-admin")
I then got an error saying: "[error] critical error: ReferenceError: require is not defined"
Is webpack absolutely necessary for this to run? It does't seem like any of this code would run client side (I hope, unless I am misunderstanding it). I started with the glitch examples in this project. I wanted to connect a firebase database but kept getting errors when trying to install the firebase-admin package. After a lot of research it seems like firebase-admin isn't compatible with webpack, I guess since it is supposed to be back-end only.
Here's my code. It's just the glitch example with firebase thrown at the top. It throws a million errors about "Field 'browser' doesn't contain a valid alias configuration"
I tried having webpack just skip that require using
__non_webpack_require__("firebase-admin")I then got an error saying: "[error] critical error: ReferenceError: require is not defined"