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

skip vite prebundling step #468

Merged
merged 1 commit into from
Mar 8, 2021
Merged

skip vite prebundling step #468

merged 1 commit into from
Mar 8, 2021

Conversation

Rich-Harris
Copy link
Member

So this was a fun debugging experience:

Vite scans your app, starting at your HTML files, looking for dependencies to prebundle before it bundles your actual app. Not totally sure I understand why this is necessary in SSR mode, or if build.lib is specified, but it happens.

Unfortunately, it does that by globbing for HTML files in the project directory. In a standard Vite project that's fine, because it excludes the build directory from the globbing, but it obviously doesn't know not to look at a SvelteKit adapter's output directory.

Suppose you're building an app that uses adapter-static to bake out some HTML for every page in your site. Let's further postulate that the site in question has a page for every county in the US, plus a few other pages, and needs to be built twice (the second time for AMP). Finally, imagine that the src/app.html template and its AMP counterpart contain hundreds of elements before you add your content.

Vite will try to parse and walk all ~7,000 large pages at once. There is no --max-old-space-size that would make this possible.

Luckily, disabling it is very easy, hence this PR.

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

Successfully merging this pull request may close these issues.

1 participant