Skip to content

Transpile server code #562

@brillout

Description

@brillout

By default, your server code isn't processed by Vite:

// server/index.js

// This file isn't processed by Vite. Consequently:
//  - When changing this file, you needed to manually restart your server for your changes to take effect.
//  - To use your environment variables defined in your .env files, you need to install dotenv.
//    See: https://vite-plugin-ssr.com/env
//  - To use your path aliases defined in your vite.config.js, you need to tell Node.js about them.
//    See: https://vite-plugin-ssr.com/path-aliases

// Your server, for example an Express.js app
import express from 'express'
const app = express()

// ...

If you want Vite to process your server code then use one of these:

If you merely want to transpile TypeScript, you can use:

Instead of having to use an extra tool, vike should have a new option server: './path/to/server/entry.ts'.

Edit:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions