Skip to content

Commit

Permalink
Use Vite to serve and build server code. Fixes build. (#824)
Browse files Browse the repository at this point in the history
* Use Vite to serve and build server code. Fixes build.

* Move vite and plugins into deps.
  • Loading branch information
yuchenshi authored Jul 1, 2022
1 parent 79f0e50 commit dacf96e
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 1,899 deletions.
Empty file removed .env
Empty file.
1 change: 1 addition & 0 deletions .env.server
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=production
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
/coverage

# production
/build
/server.bundle.js
/dist

# misc
.DS_Store
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ If you get port conflict errors, make sure to stop other instances of the Fireba

Builds the app for production, both server and web.

The web production build will be output to the `build` folder.<br />
The web production build will be output to the `dist/client` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />

The server code will be packed into `server.bundle.js`, which is a standalone
JS file including all dependencies, ready for execution with Node.js.
The server code will be packed into `dist/server/server.js`, which is a
standalone JS file including all dependencies, ready for execution with Node.js.

To run the production build with emulators, use:

```bash
firebase emulators:exec --project sample --only database,firestore --import test-data 'PORT=3000 node server.bundle.js'
firebase emulators:exec --project demo-example --import test-data 'node dist/server/server.js'
```

This will start a server that serves both the static files and APIs at `http://localhost:3000/`.
Expand Down
Loading

0 comments on commit dacf96e

Please sign in to comment.