diff --git a/packages/vite/package.json b/packages/vite/package.json index 7304197194..7b5db4123c 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -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.9.0", "vite": "~3.0.4", diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index aed7ff4c8c..99f58330d2 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -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' @@ -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) diff --git a/yarn.lock b/yarn.lock index 1159117c73..2cdf118b76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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.9.0