Skip to content

Serve static assets from src folder during development in a custom server setup? #1914

Discussion options

You must be logged in to vote

False alarm. Not a bug. It's literally just this in the `vite.config.js.

TL;DR; When running a custom server setup with @hono/vite-dev- make sure to exclude png, jpg, webp (static assets) in the devServer plugin.

Reproduction here: https://github.com/Blankeos/mre-image-import-vike-bug

1) For Hono's case this is super easy:

// Hono
import devServer from "@hono/vite-dev-server";

// Vike
import vikeSolid from "vike-solid/vite";
import vike from "vike/plugin";

// Vite
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    devServer({
      entry: "server.ts",

      exclude: [
        /^\/@.+$/,
        /.*\.(ts|tsx|vue)($|\?)/,
        /.*\.(s?css|less)($|\?)/,

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Blankeos
Comment options

Answer selected by Blankeos
@brillout
Comment options

@Blankeos
Comment options

@brillout
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants