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

Error trying to use: __DEFINES__ is not defined #283

Open
StringKe opened this issue Apr 11, 2024 · 3 comments
Open

Error trying to use: __DEFINES__ is not defined #283

StringKe opened this issue Apr 11, 2024 · 3 comments

Comments

@StringKe
Copy link

StringKe commented Apr 11, 2024

I'm wrapping up a tanstack-router based ssr framework (similar to nextjs)

Currently the javascript is not loading correctly in the browser (mine-type error or vite error)

repo: https://github.com/StringKe/qingmu

CleanShot 2024-04-12 at 02 00 01@2x

A guess about this error: the import in entry.client.tsx was not processed by vite and the content was returned uncompiled.

@StringKe
Copy link
Author

StringKe commented Apr 12, 2024

Failed to resolve module specifier "pathe". Relative references must start with either "/", "./", or "../".

https://github.com/nksaraf/vinxi/blob/main/packages/vinxi/lib/path.js

Regarding this error I did not encounter it after I pulled vinxi locally and added my code to exmaples as a subproject.

@CodeInKlingon
Copy link

I'm running into this issue as well. Here is a repro for a vue ssr app.
https://stackblitz.com/edit/vitejs-vite-flukcx?file=vite.config.ts
Interestingly a nearly identical setup in just spa mode works just fine.
https://stackblitz.com/edit/github-ewxdpx?file=app.config.js

@CodeInKlingon
Copy link

I've found a workaround but I'm not sure what the ramifications of it would be.

Add the vinxi config plugin import to your vinxi config file:

import { config } from 'vinxi/plugins/config';

in the client route under the vite plugins section add the config plugin like so:

plugins: () => [
    config('custom', {
        define: {
            __DEFINES__: '{}',
	},
    }),
    ...// the rest of your plugins
]

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

No branches or pull requests

2 participants