Skip to content

Commit

Permalink
fix: soft-deprecate setting config over Vite plugin (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Feb 7, 2024
1 parent 633396d commit 2657f86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const port = 3000

export default {
plugins: [
// @ts-expect-error
telefunc({
disableNamingConvention: true
})
Expand Down
11 changes: 7 additions & 4 deletions telefunc/node/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ import type { Plugin } from 'vite'
import type { ConfigUser } from '../server/serverConfig'

// Return as `any` to avoid Plugin type mismatches when there are multiple Vite versions installed
function plugin(configUser?: ConfigUser): any {
function plugin(
/** @deprecated */
configUser?: never
): any {
importGlobOn()

// - For dev
// - Ensures that `configUser` is valid before `config` is serialized while building
Object.assign(config, configUser)
// We use this for minimal /examples/* that don't have any server code.
// Telefunc users aren't expected to use this. (We expect users to always have server code.)
Object.assign(config, configUser as undefined | ConfigUser)

const plugins: Plugin[] = [
transform(),
Expand Down

0 comments on commit 2657f86

Please sign in to comment.