Rust discount function (one automatic discount evaluating all offers in priority order, parity with the Odoo engine), React Router admin with Polaris, theme app extension and app proxy pages, webhooks incl. GDPR, managed-pricing limits, and a Docker Compose stack (Postgres + Caddy HTTPS) for a single VPS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import { reactRouter } from "@react-router/dev/vite";
|
|
import { defineConfig, type UserConfig } from "vite";
|
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
|
// Related: https://github.com/remix-run/remix/issues/2835#issuecomment-1144102176
|
|
// Replace the HOST env var with SHOPIFY_APP_URL so that it doesn't break the Vite server.
|
|
// The CLI will eventually stop passing in HOST,
|
|
// so we can remove this workaround after the next major release.
|
|
if (
|
|
process.env.HOST &&
|
|
(!process.env.SHOPIFY_APP_URL ||
|
|
process.env.SHOPIFY_APP_URL === process.env.HOST)
|
|
) {
|
|
process.env.SHOPIFY_APP_URL = process.env.HOST;
|
|
delete process.env.HOST;
|
|
}
|
|
|
|
const host = new URL(process.env.SHOPIFY_APP_URL || "http://localhost")
|
|
.hostname;
|
|
|
|
let hmrConfig;
|
|
if (host === "localhost") {
|
|
hmrConfig = {
|
|
protocol: "ws",
|
|
host: "localhost",
|
|
port: 64999,
|
|
clientPort: 64999,
|
|
};
|
|
} else {
|
|
hmrConfig = {
|
|
protocol: "wss",
|
|
host: host,
|
|
port: parseInt(process.env.FRONTEND_PORT!) || 8002,
|
|
clientPort: 443,
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
server: {
|
|
allowedHosts: [host],
|
|
cors: {
|
|
preflightContinue: true,
|
|
},
|
|
port: Number(process.env.PORT || 3000),
|
|
hmr: hmrConfig,
|
|
fs: {
|
|
// See https://vitejs.dev/config/server-options.html#server-fs-allow for more information
|
|
allow: ["app", "node_modules"],
|
|
},
|
|
},
|
|
plugins: [
|
|
reactRouter(),
|
|
tsconfigPaths(),
|
|
],
|
|
build: {
|
|
assetsInlineLimit: 0,
|
|
},
|
|
optimizeDeps: {
|
|
include: ["@shopify/app-bridge-react"],
|
|
},
|
|
}) satisfies UserConfig;
|