-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
431 Request Header Fields Too Large #4636
Comments
Most likely related to vitejs/vite#8427
If it's a separate package then it can be excluded using optimizeDeps.exclude. If it's not then you'll need to generate/patch the rust_lib.mjs such that it's just vite: {
plugins: [
{
name: 'fix-wasm',
transform(code, id) {
if (id.endsWith('.vitepress/theme/pkg/rust_lib.mjs')) {
return {
code: code.replace(/new URL\((".*"), import.meta.url\)/, '$1'),
map: null
}
}
}
}
]
} |
I can confirm that this is indeed a separate package. We're using 'agentos-n' as an external dependency in our project, not as part of our codebase. We've already implemented the optimizeDeps: {
exclude: ['agentos-n'],
} However, we're still encountering the issue with the WASM loading. The error occurs specifically when the package attempts to use Is there a way to apply your suggested plugin solution to an external package like 'agentos-n'? Or would we need to fork and modify the package itself to resolve this issue? |
Seems like a bug with vite 5. It works fine with vite 6. (was fixed by vitejs/vite#18163) Just this works fine: import { componentPreview, containerPreview } from '@vitepress-demo-preview/plugin'
import { defineConfig } from 'vitepress'
export default defineConfig({
markdown: {
config(md) {
md.use(containerPreview)
md.use(componentPreview)
}
},
vite: {
resolve: {
alias: [
{
find: /^vue$/,
replacement: 'vue/dist/vue.esm-bundler.js'
}
]
},
ssr: {
noExternal: ['vue']
}
}
}) import { AntDesignContainer } from '@vitepress-demo-preview/component'
import '@vitepress-demo-preview/component/dist/style.css'
import { createPlugin } from 'agentos-n'
import { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { onMounted } from 'vue'
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
app.component('demo-preview', AntDesignContainer)
},
setup() {
onMounted(async () => {
await createPlugin()
})
}
} satisfies Theme no need to exclude from optimizeDeps either since it's using inline wasm. In dev there are some warnings regarding sourcemaps but I think they are from that container component. Probably can be ignored. Change your deps to these, and delete lock file and node_modules and re-run {
"private": true,
"type": "module",
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
},
"devDependencies": {
"@vitepress-demo-preview/component": "^2.3.2",
"@vitepress-demo-preview/plugin": "^1.4.0",
"agentos-n": "^1.0.0",
"js-base64": "^3.7.7"
"vitepress": "next",
"vue": "^3.5.13",
}
} |
Thank you for solving my issue! I really appreciate your help. I have one additional point to mention: Currently, the line This would provide more flexibility in our project structure and TypeScript module configuration. |
It should already work - https://stackblitz.com/edit/vite-1uhrsqz4?file=docs/.vitepress/theme/index.mts |
Seems like some vite bug. I'll try to find/create an issue there. Please track #4644 Seems like resolve.extensions is not properly merged. Workaround: vite: {
resolve: {
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
}
} |
Thanks for the update! 🙏 I'll track #4644 and a temporary workaround. Appreciate your help! 🚀 |
Describe the bug
Local error:
Stackblitz case error:
See url: https://stackblitz.com/edit/vite-6uhev3lw
Reproduction
Expected behavior
I hope to solve the issue of Status Code 431 so that Wasm initialization can be successful
System Info
Additional context
When adding the following configuration in the config. mjs file, it still doesn't work.
No response
Validations
The text was updated successfully, but these errors were encountered: