Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: Plugins prop can be a function but types don't show that #1276

Closed
2 tasks done
edivados opened this issue Jan 23, 2024 · 5 comments
Closed
2 tasks done

[Bug?]: Plugins prop can be a function but types don't show that #1276

edivados opened this issue Jan 23, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@edivados
Copy link
Contributor

edivados commented Jan 23, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

image

Expected behavior 🤔

image

Steps to reproduce 🕹

Open in StackBlitz

Steps:

import { defineConfig } from "@solidjs/start/config";

export default defineConfig({
  plugins() {
    return []
  }
});

Context 🔦

No response

Your environment 🌎

@solidjs/start: 0.4.10
@edivados edivados added the bug Something isn't working label Jan 23, 2024
@ryansolid
Copy link
Member

ryansolid commented Jan 23, 2024

Does Vite support plugin functions.. I was trying to avoid straying from Vite conventions in Vite config. It might be not accomplishable but generally that was the goal.

And I now see #1277 is why you reported this. Hmm...

@edivados
Copy link
Contributor Author

edivados commented Jan 23, 2024

And I now see #1277 is why you reported this. Hmm...

Not quite. It helps with that but I reported this one because Solid-Start accepts a function for plugins but doesn't show it. Why hide it?

@nksaraf
Copy link
Member

nksaraf commented Jan 25, 2024

Vite's way of supporting something like this is to make the whole config a function that can be run multiple times. But I think that's overkill and just making plugins be a function solves all the issues

@ryansolid
Copy link
Member

@nksaraf Yeah I just worry that people won't expect that. People expecting Vitest to work with the same config. I'd rather just wrap the whole thing in a function if that is the case. I'm ok with us diverging from Vite config in the sense that not all options are present or work. Because then people will not use them. But we can't change the API of existing options I think and still gain the right benefit. If the whole defineConfig accepts a function and that would work in Vite and Vitest I'm pretty stoked.

I don't know enough about the testing story (maybe @atk does) to quite understand it. And maybe stuff like the way insert plugins will never make it work so my point is mute. But my hunch is that building to the future it is a safer stance to take.

@nksaraf
Copy link
Member

nksaraf commented Jan 28, 2024

While I agree if we could just accept a list of plugins and have them work everywhere I would do that. The functional syntax is important for each router to have an independent pipeline (I know u already know that). We could make the whole config a function and then call that twice to get two copies of the config (one for server and client) this might be the best idea for this stance right now.

  • For testing. What Vinxi is going to do is .. you can import from the app.config.js or vite.config.js and the app instance Vinxi creates will have a function called 'getTestConfig()' that will adapt the internal vite config to a vitest config

@ryansolid ryansolid added enhancement New feature or request and removed bug Something isn't working labels Feb 12, 2024
ryansolid added a commit that referenced this issue Mar 6, 2024
commit f5ec449f4df13c0f74613cb305c5f06c38778af6
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Wed Mar 6 10:44:27 2024 -0800

    update config to anticipate Vite updates, clearer experimental features, routesDir

commit c879a3c41cfd7ae6cf53fa3ccfff5c7b44a90a1f
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Mar 5 16:28:14 2024 -0800

    fix FS router circular dep by moving import

commit 336aafb79ef42550f08a1c9b987c45960421d906
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Mar 5 14:06:58 2024 -0800

    transparent errors and support http status forwarding in server fns

commit fbeed39064667ed95cc448121846c5c44c7b4eb1
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Mar 5 12:40:41 2024 -0800

    bump vinxi plugins

commit a34dec859a2be52ffdb4ae691bb234a43a21d444
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Mon Mar 4 14:00:59 2024 -0800

    v0.6.1

commit db999705047582d208728ee6824ef07bcad24ede
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Mon Mar 4 13:37:55 2024 -0800

    update ts, fix #1346 flash types

commit 33a66aa5d5c71a3a0dee42a78952a75b1b38f320
Author: Patrick G <doeixd@gmail.com>
Date:   Mon Mar 4 15:29:40 2024 -0500

    Update package.json to include license (#1361)

    * Update package.json To include license

    JSDocs.io won't work without it.

    https://www.jsdocs.io/package/@solidjs/start

    * Create quiet-meals-heal.md

    ---------

    Co-authored-by: Ryan Carniato <ryansolid@gmail.com>

commit 9c4c7c01cefd7c85a7e858f3d2ca72f93d165138
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Mon Mar 4 12:25:53 2024 -0800

    update router

commit 28d77d3343f1aa53e477038ad4abede83329b03c
Author: Birk Skyum <74932975+birkskyum@users.noreply.github.com>
Date:   Mon Mar 4 18:23:32 2024 +0100

    Bump vinxi to ^0.3.9 everywhere (#1358)

    Co-authored-by: Ryan Carniato <ryansolid@gmail.com>

commit 6822b2e09753d38800b9ef7f7e7831452e48101a
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Mon Mar 4 09:20:09 2024 -0800

    unlock package.json again

commit 4889606a5833b64f3c4bdf9a6ccdef8f4ca3194c
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Thu Feb 29 10:59:25 2024 +0100

    temporary lock vinxi version

commit 5402007cb03000ef06b0cc3adef04a09a4b729bf
Author: Alexis H. Munsayac <alexis.munsayac@gmail.com>
Date:   Thu Feb 29 15:12:20 2024 +0800

    Fix refresh pragma (#1348)

    * Fix refresh pragma

    * Add changeset

    ---------

    Co-authored-by: Ryan Carniato <ryansolid@gmail.com>

commit dd37a5bed7d586f485bfe9e3992d44160948fac6
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Feb 27 14:32:31 2024 -0800

    v0.6.0

commit 7d3355a400ddc45a12489a51f2bed6db7491578d
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Feb 27 09:16:48 2024 -0800

    update vinxi, fix prerendering

commit 3634dd7599552cccc0e68b9eab0091bdcbfc2d85
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Mon Feb 26 12:07:20 2024 -0800

    configurable dev overlay

commit eecc8dcfdbfc66f313ff1bd79f2d424b719c13d3
Author: Nikhil Saraf <nsaraf98@gmail.com>
Date:   Mon Feb 26 21:10:44 2024 +0530

    Add @mdx-js/mdx dependency

commit c0973a0c96b523cd4fde3c4a30c1d00b59342c4f
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Sat Feb 24 09:24:12 2024 -0800

    dedupe plugins

commit 52e1f4427e9c76af0518ed05e210a4848af1f6db
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Fri Feb 23 16:00:29 2024 -0800

    move server rendering options to handler

commit 03d409a650db6f5a2ead6b2e8b84c74f2a74ab5b
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Fri Feb 23 15:40:40 2024 -0800

    fix nojs flash update auth/prisma examples

commit f80aedbea9ccdda29ea9a45fbba852f20aff65e1
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Fri Feb 23 12:25:23 2024 -0800

    vite.config -> app.config

commit a9cf09db7e00a643b686482b95f730f0d6ecc1be
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Thu Feb 22 15:29:53 2024 -0800

    v0.5.10

commit e3a0a09a2de989b111c20df1d5af0cd1130ca0e3
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Thu Feb 22 15:28:48 2024 -0800

    fix nojs return responses, fix throw single flight

commit fcdb8aa0ffe61a0190c15fa9d68bb3517909ac12
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Feb 20 22:37:48 2024 -0800

    handler options as function, forward nonce to main scripts

commit 076aef995812eb59b379c5c017f64a303afda04e
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Feb 20 16:08:38 2024 -0800

    fix #1276 - functions for plugins option

commit 58e3eac56474e62d929a0d934df05d6bfbc43e6a
Author: Ryan Carniato <ryansolid@gmail.com>
Date:   Tue Feb 20 15:24:34 2024 -0800

    update some versions

commit 33b471cb02d11858b4e0cc6ff156e5775f6ccb96
Author: Birk Skyum <birk.skyum@pm.me>
Date:   Wed Feb 14 10:10:20 2024 +0100

    Vinxi 0.2.1 -> 0.3.3

commit 36b7912
Merge: d149a60 6b08018
Author: Katja Lutz <katywings@users.noreply.github.com>
Date:   Tue Feb 20 23:31:06 2024 +0100

    Merge branch 'main' into vinxi-51-rpc-info

commit d149a60
Merge: 2aac293 f787f2b
Author: Katja Lutz <katywings@users.noreply.github.com>
Date:   Sun Feb 11 20:35:34 2024 +0100

    Merge branch 'main' into vinxi-51-rpc-info

commit 2aac293
Author: Katja Lutz <mail@katjalutz.ch>
Date:   Sun Dec 31 17:02:43 2023 +0100

    feat: implement getServerFunctionMeta

    Refs: nksaraf/vinxi#51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants