GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Vite Vue native SFC assembly bypasses pre-compiler plugin transforms · Issue #11556 · NativeScript/NativeScript

Vite Vue native SFC assembly bypasses pre-compiler plugin transforms #11556

New issue
Copy link
New issue
Copy link
Open
Open
Vite Vue native SFC assembly bypasses pre-compiler plugin transforms#11556
Copy link
Labels
bugvue

Description

@rafaelaugustos
rafaelaugustos
opened on Oct 19, 2026
Issue body actions

Issue Description

The native Vue HMR SFC assembler recompiles the original .vue file from disk, bypassing user Vite enforce: 'pre' transforms that run before @vitejs/plugin-vue. A compile-time macro removed by a Vite plugin therefore reaches native setup and throws, while the same application works with --no-hmr.

Found while adding optional native file routing: rafaelaugustos/vue-router-ns#100. The plugin removes definePageMeta(...) and its import before Vue compilation and supplies transformed source to the Vue HMR context.read hook. This is sufficient for the bundled build and real Vite dev-server tests, but not the native SFC assembler.

Reproduction and evidence

  • NativeScript-Vue page containing a top-level definePageMeta({ layout: 'default' }) in <script setup>.
  • Native file-routing plugin installed as an enforce: 'pre' Vite transform alongside @nativescript/vite/vue.
  • ns run android --no-hmr: 15 native navigation assertions pass (layouts, middleware, params, two stacks, modal results, Back/drafts). Bundled iOS passes the same 15 assertions.
  • With native Vite HMR enabled and a packed router dependency: startup fails with ReferenceError: definePageMeta is not defined, before the first navigation assertion. Importing the macro explicitly instead does not solve bypassing its compile-time transformation.

This is independent of #11554: installing the router as a packed dependency avoids the raw linked-module import path, then exposes this SFC failure. No third-party dependency sources were patched during these runs.

Source trace

At main 3224f1b, packages/vite/hmr/frameworks/vue/server/sfc-route-assemble.ts warms server.transformRequest(base + '?vue'), explicitly discards the result, reads the file using readFileSync, then calls the Vue SFC parser/compiler directly. The sfc-route-serve.ts fallback also reads source directly. Therefore normal plugin transformations do not feed these native compilation paths. Signature classification also reads raw source, which matters for metadata-only edits preserving open native Pages.

Expected: a supported pre-SFC source transformation path shared by bundled builds, native assembly, fallback and HMR classification. A plugin should not have to rewrite source files on disk or install a runtime no-op for its compile-time macro.

Environment

macOS, Node 22.23.3, CLI 9.1.2, @nativescript/vite 8.0.19, Vite 8.3.4, NativeScript-Vue 3.1.2, Core 9.1.3. HMR failure reproduced on Android 16/API 36 emulator; no-HMR acceptance on Android and iOS 26 simulator. Native HMR has not been validated on iOS for this integration.

Activity

  1. NathanWalker
    added
    bug
    vue
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugvue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.