nuxt / vite

⚡ Vite Experience with Nuxt 2

Home Page:https://vite.nuxtjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`vite.base`/ `nuxt.router.base` unsupported

Patrick-Remy opened this issue · comments

Versions

nuxt-vite: v0.1.1
nuxt: v2.15.7

Reproduction

Tbd

Description

If using vite.base option, the build will get broken. But it isn't required as files are properly generated and moved to subdir already by nuxt. Only the router.base option should be reflected in the DEFAULT_APP_TEMPLATE and APP_TEMPLATE.

Update: Unfortunately the build must also be fixed, as if vite.base isn't set any imports in the resulting scripts are using absolute paths.

Previous issue description

This was caused by setting the vite.base option!

I am not sure, if layouts are currently supported by this plugin. The example doesn't have any and in my case I receive the message:

ERROR /src/layouts/error.vue has no corresponding SFC entry in the cache. This is a vite-plugin-vue2 internal error, please open an issue.

This is also the case if I delete this 'layout', the error still exists with path /.nuxt/components/nuxt-error.vue. So I am not sure, if this is work nuxt/vite needs to do (e.g. inject components in layouts dir?) or it

@Patrick-Remy Can you verify if 0.2.x fix this?

I can test it in two weeks 👍

Yes it works great as expected, thanks for your fast fix.

I am sorry, there is still missing base path for vite and nuxt client.js in index.html

    <script type="module" src="/@vite/client"></script>
    <script type="module" src="/_nuxt/client.js"></script>

But it's perfect now for other places, like user-defined resources.

Not sure if something like this would fix it: Patrick-Remy@f7a832c
As I can't test it, when I install the package from my github or local path, it fails with weird require errors.