create-surf-app 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +13 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -118,6 +118,7 @@ createServer().start()
118
118
  "frontend/package.json": JSON.stringify(frontendPkg, null, 2),
119
119
  "frontend/.env": `VITE_PORT=${frontendPort}
120
120
  VITE_BACKEND_PORT=${backendPort}
121
+ VITE_BASE=${process.env.VITE_BASE || "/"}
121
122
  `,
122
123
  "frontend/vite.config.ts": `import { defineConfig, loadEnv } from 'vite'
123
124
  import react from '@vitejs/plugin-react'
@@ -142,15 +143,25 @@ function requiredPort(name: string) {
142
143
 
143
144
  const FRONTEND_PORT = requiredPort('VITE_PORT')
144
145
  const BACKEND_PORT = requiredPort('VITE_BACKEND_PORT')
146
+ const BASE = env.VITE_BASE || '/'
145
147
 
146
148
  export default defineConfig({
149
+ base: BASE,
147
150
  plugins: [react(), tailwindcss()],
148
151
  server: {
149
152
  port: FRONTEND_PORT,
150
153
  host: '0.0.0.0',
151
154
  proxy: {
152
- '/proxy': { target: \`http://127.0.0.1:\${BACKEND_PORT}\`, changeOrigin: true },
153
- '/api': { target: \`http://127.0.0.1:\${BACKEND_PORT}\`, changeOrigin: true },
155
+ [\`\${BASE}proxy\`]: {
156
+ target: \`http://127.0.0.1:\${BACKEND_PORT}\`,
157
+ changeOrigin: true,
158
+ rewrite: (p: string) => p.replace(new RegExp(\`^\${BASE.replace(/[.*+?^\${}()|[\\\\]\\\\\\\\]/g, '\\\\\\\\$&')}\`), '/'),
159
+ },
160
+ [\`\${BASE}api\`]: {
161
+ target: \`http://127.0.0.1:\${BACKEND_PORT}\`,
162
+ changeOrigin: true,
163
+ rewrite: (p: string) => p.replace(new RegExp(\`^\${BASE.replace(/[.*+?^\${}()|[\\\\]\\\\\\\\]/g, '\\\\\\\\$&')}\`), '/'),
164
+ },
154
165
  },
155
166
  },
156
167
  resolve: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-surf-app",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Scaffold a Surf app — Vite + React + Express + @surf-ai/sdk",
5
5
  "type": "module",
6
6
  "bin": {