Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(vite): add hotfix for netlify deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 7, 2022
1 parent 2cbdc5c commit 34bd8a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"postcss-url": "^10.1.3",
"rollup": "^2.77.2",
"rollup-plugin-visualizer": "^5.7.1",
"std-env": "^3.1.1",
"ufo": "^0.8.5",
"unplugin": "^0.8.1",
"vite": "~3.0.4",
Expand Down
7 changes: 7 additions & 0 deletions packages/vite/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { resolveTSConfig } from 'pkg-types'
import { resolve } from 'pathe'
import * as vite from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import { provider } from 'std-env'
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
import { logger, resolveModule } from '@nuxt/kit'
import { joinURL, withoutLeadingSlash, withTrailingSlash } from 'ufo'
import type { OutputOptions } from 'rollup'
import { ViteBuildContext, ViteOptions } from './vite'
import { wpfs } from './utils/wpfs'
import { cacheDirPlugin } from './plugins/cache-dir'
Expand Down Expand Up @@ -110,6 +112,11 @@ export async function buildServer (ctx: ViteBuildContext) {
}))
}

// Hotfix for https://github.com/nuxt/framework/issues/6204
if (provider === 'netlify') {
(serverConfig.build.rollupOptions.output as OutputOptions).inlineDynamicImports = true
}

await ctx.nuxt.callHook('vite:extendConfig', serverConfig, { isClient: false, isServer: true })

const onBuild = () => ctx.nuxt.callHook('build:resources', wpfs)
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,7 @@ __metadata:
postcss-url: ^10.1.3
rollup: ^2.77.2
rollup-plugin-visualizer: ^5.7.1
std-env: ^3.1.1
ufo: ^0.8.5
unbuild: latest
unplugin: ^0.8.1
Expand Down

0 comments on commit 34bd8a8

Please sign in to comment.