mirror of
https://github.com/TanStack/router.git
synced 2026-11-16 19:38:07 +00:00
fix(start-plugin-core): compile a Vue SFC's script block on Rsbuild, once
With vue-loader's inline match resource (`@rsbuild/plugin-vue`'s default) the script block is `x.vue.js?vue&type=script…`: Start's `pre` loader saw the SFC's text before vue-loader, and the late rule (`.vue`) matched only the glue module, so no Start pass compiled `<script setup>` or `<script>`: server code shipped to the client and isomorphic fns ran their server side in the browser, in dev and in production builds. Without the inline match resource the late rule matched the block, but vue-loader's pitcher copies the block's loaders into the request it generates and Rspack applies the configured `post` rule again: the late pass compiled its own output and server fns failed when called. When vue-loader's plugin is in the configuration, a `post` rule runs the late pass over the script block under its match resource (`rsbuild/vue.ts`), and a late loader that runs again later in its chain passes through: one late pass per module. Nothing changes for apps without vue-loader. Tests: an Rsbuild integration test with `pluginVue`, inline match resource on and off, build and dev (client without the server code, server with it, calls by id and from a page, isomorphic client implementation, a JS `<script setup>` refused in dev); a Vue SFC with a server fn and an isomorphic fn in `e2e/vue-start/basic` (Vite modes get `@vitejs/plugin-vue`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5bc674ea80
commit
04c9593d3d
15 changed files with 462 additions and 24 deletions
6
e2e/vue-start/basic/src/vue-shim.d.ts
vendored
6
e2e/vue-start/basic/src/vue-shim.d.ts
vendored
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
Loading…
Add table
Add a link
Reference in a new issue