jycouet / kitql

A set of standalone tools to SpeedRun WebApps!
https://kitql.dev
MIT License
405 stars 37 forks source link

vite-plugin-striper + remult + @BackendMethod decorator on entity - shows errors #539

Closed mihaa1 closed 10 months ago

mihaa1 commented 10 months ago

Describe the bug

Reproduce:

Code: Entity:

import { Allow, BackendMethod, Entity, Fields, Validators } from 'remult'

@Entity<User2>('userstest', {
    allowApiCrud: Allow.authenticated,
})
export class User2 {
    @Fields.uuid()
    id = ''

    @Fields.string({
        validate: [Validators.required, Validators.uniqueOnBackend],
    })
    email = ''

    @BackendMethod({ allowed: Allow.everyone })
    async testMethod() {
        console.log('hello')
    }
}

vite.config.ts

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { striper } from 'vite-plugin-striper'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [striper({ decorators: ['BackendMethod'] }), react()],
    server: { proxy: { '/api': 'http://localhost:3002' } },
})

Severity

serious, but I can work around it

Steps to Reproduce the Bug

Reproduce:

Reproduction

No response

jycouet commented 10 months ago

Thx for reporting, I'll have a look later today

jycouet commented 10 months ago

@all-contributors please add @mihaa1 for bug

allcontributors[bot] commented 10 months ago

@jycouet

I've put up a pull request to add @mihaa1! :tada:

jycouet commented 10 months ago

πŸš€ vite-plugin-striper@0.0.7 it out. πŸš€

Could you try and let me know ? I let you close the issue if it's solved πŸ‘

mihaa1 commented 10 months ago

Thanks for the quick fix. I'm getting a weird error with 0.08. I was using 0.04, and all versions above that give me this:

failed to load config from /Users/vite.config.ts
error when starting dev server:
TypeError: (0 , import_vite_plugin_watch_and_run.default) is not a function

Checking with u before I start to dig further

jycouet commented 10 months ago

Thx for the quick notice, I'll have a look right now.

jycouet commented 10 months ago

Let's chat here: https://discord.com/channels/975754286384418847/1183356577835647086/1183830630090420296

jycouet commented 10 months ago

πŸš€ vite-plugin-striper@0.1.4 it out. πŸš€

Could you try and let me know ? I let you close the issue if it's solved πŸ‘

mihaa1 commented 10 months ago

Works, thanks!