fix(vite): use baseURL + assetsDir as base in dev mode (#7234)

This commit is contained in:
Daniel Roe 2022-09-05 09:48:35 +01:00 committed by GitHub
parent 4bd1be9174
commit 1abd5f1959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,9 @@ export async function buildClient (ctx: ViteBuildContext) {
const clientConfig: vite.InlineConfig = vite.mergeConfig(ctx.config, { const clientConfig: vite.InlineConfig = vite.mergeConfig(ctx.config, {
entry: ctx.entry, entry: ctx.entry,
base: './', base: ctx.nuxt.options.dev
? joinURL(ctx.nuxt.options.app.baseURL.replace(/^\.\//, '/') || '/', ctx.nuxt.options.app.buildAssetsDir)
: './',
experimental: { experimental: {
renderBuiltUrl: (filename, { type, hostType }) => { renderBuiltUrl: (filename, { type, hostType }) => {
if (hostType !== 'js' || type === 'asset') { if (hostType !== 'js' || type === 'asset') {