Skip to content

Commit 520c35a

Browse files
authored
Adds support for client subdir (#1516)
1 parent 9f31b32 commit 520c35a

File tree

33 files changed

+150
-41
lines changed

33 files changed

+150
-41
lines changed

waspc/ChangeLog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 0.11.8
4+
5+
### 🎉 [New Feature] Serving the Client From a Subdirectory
6+
7+
You can now serve the client from a subdirectory. This is useful if you want to serve the client from a subdirectory of your domain, e.g. `https://example.com/my-app/`.
8+
9+
To do this, you need to add the `client.baseDir` property to your `.wasp` file:
10+
11+
```wasp
12+
app todoApp {
13+
// ...
14+
client: {
15+
baseDir: "/my-app",
16+
},
17+
}
18+
```
19+
320
## 0.11.7
421

522
### 🐞 Bug fixes / 🔧 small improvements

waspc/data/Generator/templates/react-app/src/router.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const routes = {
4747
export type Routes = RouteDefinitionsToRoutes<typeof routes>
4848

4949
const router = (
50-
<Router>
50+
<Router basename="{= baseDir =}">
5151
{=# rootComponent.isDefined =}
5252
<{= rootComponent.importIdentifier =}>
5353
{=/ rootComponent.isDefined =}

waspc/data/Generator/templates/react-app/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ const _waspUserProvidedConfig = {};
1212
{=/ customViteConfig.isDefined =}
1313

1414
const defaultViteConfig = {
15+
base: "{= baseDir =}",
1516
plugins: [react()],
1617
server: {
17-
port: 3000,
18+
port: {= defaultClientPort =},
1819
host: "0.0.0.0",
1920
open: true,
2021
},

waspc/data/Generator/templates/server/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const resolvedConfig = merge(config.all, config[env])
3232
export default resolvedConfig
3333

3434
function getDevelopmentConfig() {
35-
const frontendUrl = stripTrailingSlash(process.env.WASP_WEB_CLIENT_URL) || 'http://localhost:3000';
35+
const frontendUrl = stripTrailingSlash(process.env.WASP_WEB_CLIENT_URL || '{= defaultClientUrl =}');
3636
return {
3737
frontendUrl,
3838
allowedCORSOrigins: '*',

waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/.waspchecksums

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/server/src/config.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/src/router.tsx

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waspc/e2e-test/test-outputs/waspBuild-golden/waspBuild/.wasp/build/web-app/vite.config.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/.waspchecksums

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waspc/e2e-test/test-outputs/waspCompile-golden/waspCompile/.wasp/out/server/src/config.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)