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

writeBundle error with vite.build function call #13299

Open
Intexk opened this issue Jan 11, 2025 · 3 comments
Open

writeBundle error with vite.build function call #13299

Intexk opened this issue Jan 11, 2025 · 3 comments

Comments

@Intexk
Copy link

Intexk commented Jan 11, 2025

Describe the bug

this call in writeBundle asumes vite.build returns a {import('vite').Rollup.RollupOutput}
but vite.build can return one array too...

build function in vite source code

async function build(
  inlineConfig?: InlineConfig,
): Promise<RollupOutput | RollupOutput[]>

writeBundle in svelteKit

const { output } = /** @type {import('vite').Rollup.RollupOutput} */ (
	await vite.build({
		configFile: vite_config.configFile,
		// CLI args
		mode: vite_config_env.mode,
		logLevel: vite_config.logLevel,
		clearScreen: vite_config.clearScreen,
		build: {
			minify: initial_config.build?.minify,
			assetsInlineLimit: vite_config.build.assetsInlineLimit,
			sourcemap: vite_config.build.sourcemap
		},
		optimizeDeps: {
			force: vite_config.optimizeDeps.force
		}
	})
);

after that the build crashes....so i have to manually patch the sveltekit each time i update it.

Reproduction

i created this project....it's vite legacy plugin the one that triggers the build error in sveltekit

https://github.com/Intexk/tontada

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 9 5900HX with Radeon Graphics
    Memory: 47.33 GB / 63.42 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.4.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (129.0.2792.65)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    @sveltejs/adapter-static: ^3 => 3.0.8
    @sveltejs/kit: ^2 => 2.15.2
    @sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.3
    svelte: ^5.0.0 => 5.17.3
    vite: ^6.0.7 => 6.0.7

Severity

serious, but I can work around it

Additional Information

No response

@eltigerchino
Copy link
Member

Please provide a minimal reproduction where the build crashes.

@Intexk
Copy link
Author

Intexk commented Jan 13, 2025

the crash happens in this line

uses_env_dynamic_public: output.some(

error during build:
[vite-plugin-sveltekit-compile] Cannot read properties of undefined (reading 'some')
at Object.handler (xxx/node_modules/@sveltejs/kit/src/exports/vite/index.js:859:39)

@Intexk
Copy link
Author

Intexk commented Jan 13, 2025

i created this project....it's vite legacy plugin the one that triggers the build error in sveltekit

https://github.com/Intexk/tontada

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

No branches or pull requests

2 participants