diff --git a/package.json b/package.json index 5ed11038..fbc99ee4 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ "scripts": { "build": "rollup -c && node lib/move-output.js", "debug": "node --inspect-brk node_modules/.bin/rollup -c", - "dev": "run-p watch serve", + "dev": "DEV_PORT=\"${DEV_PORT:=5000}\" run-p watch serve", "watch": "rollup -cw", - "serve": "serve --config ../../../serve.json .tmp/build/static" + "serve": "serve --listen=$DEV_PORT --config ../../../serve.json .tmp/build/static" }, "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0", diff --git a/src/static-build/pages/index/index.tsx b/src/static-build/pages/index/index.tsx index c5809c5e..ea95d7f3 100644 --- a/src/static-build/pages/index/index.tsx +++ b/src/static-build/pages/index/index.tsx @@ -16,7 +16,8 @@ import baseCss from 'css:./base.css'; import initialCss from 'initial-css:'; import { allSrc } from 'client-bundle:client/initial-app'; import favicon from 'url:static-build/assets/favicon.ico'; -import { escapeStyleScriptContent } from 'static-build/utils'; +import ogImage from 'url:static-build/assets/icon-large-maskable.png'; +import { escapeStyleScriptContent, siteOrigin } from 'static-build/utils'; import Intro from 'shared/prerendered-app/Intro'; interface Props {} @@ -27,7 +28,27 @@ const Index: FunctionalComponent = () => ( Squoosh + + + + + + + + + + + { + if (process.env.DEV_PORT) return `http://localhost:${process.env.DEV_PORT}`; + // https://docs.netlify.com/configure-builds/environment-variables/#build-metadata + if (process.env.CONTEXT === 'production') return 'https://squoosh.app'; + if (process.env.DEPLOY_PRIME_URL) return process.env.DEPLOY_PRIME_URL; + console.warn( + 'Unable to determine site origin, defaulting to https://squoosh.app', + ); + return 'https://squoosh.app'; +})();