11ty / eleventy-plugin-vite

A plugin to use Vite with Eleventy
134 stars 10 forks source link

Dev server chokes the browser because of text encoding issue in absolute @fs import path #5

Closed Noleli closed 1 year ago

Noleli commented 2 years ago

First, I’m very excited to see an official way of managing client-side dependencies.

The issue I’m running into is that the Vite dev server is asking the browser to import env.mjs from an absolute @fs path on my drive, and there’s a non-ascii character (a proper ’ apostrophe) in that path (above the project root).

In localhost:8080/@vite/client:

import '/@fs/Users/noah/Documents/Noah’s stuff/Projects/Noah's Site/eleventy/node_modules/vite/dist/client/env.mjs';

I’ve tried two ways of resolving it:

eleventyConfig.addPlugin(EleventyVitePlugin, {
    server: {
        fs: {
            strict: true,
            allow: []
        }
    },
    esbuild: {
        charset: "utf8"
    }
});

Unfortunately, neither worked.

I should note that this is just a dev server issue. Builds work great. Thanks!

zachleat commented 2 years ago

HMMM

This works okay with eleventy-dev-server standalone https://github.com/11ty/eleventy-dev-server

image

I wonder if this is a Vite-specific bug?

zachleat commented 2 years ago

Test run fix https://github.com/11ty/eleventy-dev-server/actions/runs/2673373408

zachleat commented 1 year ago

This is an automated message to let you know that this issue requires additional input from the original poster and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

Do not let the issue’s closing deter you. After you’ve supplied the required information, the issue will be reopened. Thanks!