-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Describe the bug
Starting in next.360 my CI/CD build script failed with [vite-plugin-svelte-kit] Maximum call stack size exceeded
I poked around and found it coming from recurse calls to the traverse procedure added apart of #5138
I modified the traverse function to debug
function traverse(file, add_js) {
const chunk = manifest[file];
console.log('traversing chunk', {chunk})
if (imports.has(chunk.file)) return;
if (add_js) imports.add(chunk.file);
if (chunk.css) {
chunk.css.forEach((file) => {
console.log('adding stylesheet', {file})
return stylesheets.add(file)
});
}
if (chunk.imports) {
chunk.imports.forEach((file) => {
console.log('traversing import', {file})
return traverse(file, add_js)
});
}
if (add_dynamic_css && chunk.dynamicImports) {
chunk.dynamicImports.forEach((file) => {
console.log('traversing dynamic import', {file})
return traverse(file, false)
});
}
}and these where the last few lines.
I had been dynamically importing monaco-editor in one my layouts. There are workaround importing via cdnjs however being able to dynamically import it is a lot more desired.
Script to reproduce with starter project added below.
Reproduction
npm create svelte my-app
cd my-app
cat <<EOT > src/routes/__layout.svelte
<script>
import { onMount } from 'svelte';
onMount(async () => {
const monaco = await import('monaco-editor/esm/vs/editor/editor.main')
console.log({monaco})
})
</script>
<main>
<slot />
</main>
EOT
npm add monaco-editor
npm run build
Logs
✓ 844 modules transformed.
.svelte-kit/output/server/manifest.json 1.77 KiB
.svelte-kit/output/server/index.js 73.11 KiB
.svelte-kit/output/server/entries/endpoints/todos/index.js 1.33 KiB
.svelte-kit/output/server/entries/pages/__layout.svelte.js 0.25 KiB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js 0.72 KiB
.svelte-kit/output/server/entries/pages/about.svelte.js 1.51 KiB
.svelte-kit/output/server/entries/pages/index.svelte.js 9.71 KiB
.svelte-kit/output/server/entries/pages/todos/index.svelte.js 9.70 KiB
.svelte-kit/output/server/chunks/index-6892bb9c.js 3.86 KiB
.svelte-kit/output/server/chunks/hooks-ff4815b6.js 0.46 KiB
[vite-plugin-svelte-kit] Maximum call stack size exceeded
➜ my-appSystem Info
System:
OS: macOS 12.5
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 36.78 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.12.1 - ~/.nvm/versions/node/v18.4.0/bin/npm
Browsers:
Brave Browser: 103.1.40.107
Chrome: 103.0.5060.114
Firefox Nightly: 84.0a1
Safari: 15.6
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.54
@sveltejs/kit: next => 1.0.0-next.360
svelte: ^3.46.0 => 3.48.0
vite: ^2.9.13 => 2.9.13Severity
serious, but I can work around it
Additional Information
No response
alexbjorlig, tsukhu, camargo, manuganji, schindld and 3 more
Metadata
Metadata
Assignees
Labels
No labels
