Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@

### ⚠️ Breaking Changes

Remember to check out the [migration guide](https://wasp.sh/docs/migration-guide) for step-by-step documentation on how to upgrade.

- Wasp now runs and bundles your server with Vite, the same way it already did with your client. ([#4645](https://github.com/wasp-lang/wasp/pull/4645), [#4646](https://github.com/wasp-lang/wasp/pull/4646), [#4665](https://github.com/wasp-lang/wasp/pull/4665), [#4667](https://github.com/wasp-lang/wasp/pull/4667), [#4668](https://github.com/wasp-lang/wasp/pull/4668))

You must add the `waspServer()` plugin from `wasp/server/vite` to your `vite.config.ts`, otherwise Wasp won't compile your app:

```ts
import { defineConfig } from "vite";
import { wasp } from "wasp/client/vite";
import { waspServer } from "wasp/server/vite";

export default defineConfig({
plugins: [wasp(), waspServer()],
});
```

What this changes for your app:

- `wasp start` now runs a single process for your whole app, so client and server logs share the `[ App ]` prefix. The `[ Client ]` and `[ Server ]` prefixes are now only used by `wasp build start`.
- Your server restarts in place, in well under a second, and only when you change code it actually uses. Changing client-only code no longer restarts it.
- An unhandled rejection or an uncaught exception in your server code no longer kills your app in development. Wasp logs it and keeps running until your next change.
- Wasp no longer type-checks your server code while you develop, only when it bundles it. `wasp build` still fails on server type errors.
- Rollup and nodemon are gone from the generated server's dev dependencies, and so are the `watch` and `bundle-and-start` scripts in `.wasp/out/server/package.json`.
- The server bundle can now contain shared chunks in `.wasp/out/server/bundle/assets/`, next to `bundle/server.js`. Deployments that copy the whole `bundle` directory (like the Dockerfile Wasp generates) need no changes.

- Moved internal server-only import paths under the `wasp/server/...` prefix. These paths are not part of the documented public API, but if your app imported any of them, update the import path or switch to documented public imports like `wasp/server/auth`. ([#4557](https://github.com/wasp-lang/wasp/pull/4557))
- Removed the `wasp info` command, in favor of the new `wasp show` family of commands. ([#4622](https://github.com/wasp-lang/wasp/pull/4622))

Expand Down
6 changes: 5 additions & 1 deletion waspc/data/Generator/templates/server/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
`npm start` to run server in development mode (it reloads on changes).
This is your app's Node.js server, generated by Wasp. Wasp runs it for you:

- `wasp start` runs it in development, inside the Vite dev server's process.
- `npm run bundle` type-checks it and bundles it into `bundle/`, and `npm start` runs
that bundle the way production does.
13 changes: 0 additions & 13 deletions waspc/data/Generator/templates/server/nodemon.json

This file was deleted.

1 change: 0 additions & 1 deletion waspc/data/Generator/templates/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"version": "0.0.0",
"private": true,
"type": "module",
"comment-filip": "The server.js location changed because we have now included client source files above .wasp/out/server/src.",
"comment-bundle": "The `bundle` script builds the `server` Vite environment. It runs from the Wasp project's dir (three levels up) because that's where the Vite config declaring that environment lives.",
"scripts": {
"bundle": "tsc --build && cd ../../.. && node .wasp/out/sdk/wasp/scripts/build-server.mjs",
Expand Down
16 changes: 8 additions & 8 deletions waspc/data/Generator/templates/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
"strict": false,
"allowJs": true,

// This property currently doesn't matter because we haven't been running
// TSC on server code since https://github.com/wasp-lang/wasp/pull/1714.
// This property currently doesn't matter because nothing consumes TSC's
// output: the `bundle` script runs `tsc --build` only to type-check the
// server, and Vite bundles the server from the TypeScript sources.
//
// When we start running TSC again (after we fix all current errors and
// make project references work for the TS config), then I believe the
// correct configuration is "rootDir": "." (the project reference should
// take care of the user code), but we should double-check.
// If the emitted output ever starts mattering, I believe the correct
// configuration is "rootDir": "." (the project reference should take care
// of the user code), but we should double-check.
//
// Before changing this property, ensure you're aware of the implications:
// - https://github.com/wasp-lang/wasp/pull/1584#discussion_r1404019301
// - https://github.com/wasp-lang/wasp/pull/1713/files#diff-58191eecd9cc55f71c73de89420df8b1866dce38ad35f4ef0f6f8874616eda77R32
"rootDir": ".",
// Enable source map for debugging
"sourceMap": true,
// We are using rollup and extensionless imports, our module and module
// resolution reflect that.
// We are bundling with Vite and using extensionless imports, our module and
// module resolution reflect that.
"module": "preserve",
"moduleResolution": "bundler",
// The remaining settings should match the extended nodeXY/tsconfig.json, but I kept
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading
Loading