Move assetImage and outfitImage back into Nextjs

This should let us actually start working with them locally and in new prod!
This commit is contained in:
Emi Matchu 2021-11-03 17:07:25 -07:00
parent e8ed459afd
commit 171558a64f
3 changed files with 3 additions and 18 deletions

View file

@ -1,15 +0,0 @@
This is a hack to work around limitations deploying to Vercel!
- https://github.com/vercel/vercel/issues/4739#issuecomment-926879578
- https://github.com/vercel/vercel/issues/3460
API endpoints declared in here _won't_ work during local development, but _will_
work when deployed to production.
Putting the endpoint here code-splits it separately from the rest of the app
bundle, so its large dependencies aren't grouped in with the others, and thereby
it just barely stays within the dependency bundle size of 50MB. It also enables
the dependencies in our `vercel-build` step to deploy with the bundle.
If we move off Vercel, it'll be a good idea to move these endpoints back into
the /pages/api folder!

View file

@ -39,12 +39,12 @@ import fetch from "node-fetch";
import gql from "graphql-tag"; import gql from "graphql-tag";
import { print as graphqlPrint } from "graphql/language/printer"; import { print as graphqlPrint } from "graphql/language/printer";
import connectToDb from "../src/server/db"; import connectToDb from "../../src/server/db";
import { renderOutfitImage } from "../src/server/outfit-images"; import { renderOutfitImage } from "../../src/server/outfit-images";
import getVisibleLayers, { import getVisibleLayers, {
petAppearanceFragmentForGetVisibleLayers, petAppearanceFragmentForGetVisibleLayers,
itemAppearanceFragmentForGetVisibleLayers, itemAppearanceFragmentForGetVisibleLayers,
} from "../src/shared/getVisibleLayers"; } from "../../src/shared/getVisibleLayers";
const VALID_LAYER_URLS = [ const VALID_LAYER_URLS = [
/^https:\/\/(impress-asset-images\.openneo\.net|impress-asset-images\.s3\.amazonaws\.com)\/(biology|object)\/[0-9]{3}\/[0-9]{3}\/[0-9]{3}\/[0-9]+\/(150|300|600)x(150|300|600)\.png(\?[a-zA-Z0-9_-]+)?$/, /^https:\/\/(impress-asset-images\.openneo\.net|impress-asset-images\.s3\.amazonaws\.com)\/(biology|object)\/[0-9]{3}\/[0-9]{3}\/[0-9]{3}\/[0-9]+\/(150|300|600)x(150|300|600)\.png(\?[a-zA-Z0-9_-]+)?$/,