{"record":{"id":"374f39a87dbb094a","repo":"withastro/astro","slug":"astrojs-vue-appentrypoint-appentrypoint-do","errorCode":null,"errorMessage":"[@astrojs/vue] appEntrypoint `${appEntrypoint}` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.","messagePattern":"\\[@astrojs/vue\\] appEntrypoint `(.+?)` does not export a default function\\. Check out https://docs\\.astro\\.build/en/guides/integrations-guide/vue/#appentrypoint\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/vue/src/index.ts","lineNumber":79,"sourceCode":"\t\t\t\treturn RESOLVED_VIRTUAL_MODULE_ID;\n\t\t\t},\n\t\t},\n\t\tload: {\n\t\t\tfilter: {\n\t\t\t\tid: new RegExp(`^${RESOLVED_VIRTUAL_MODULE_ID}$`),\n\t\t\t},\n\t\t\thandler() {\n\t\t\t\tif (appEntrypoint) {\n\t\t\t\t\treturn `\\\nexport const setup = async (app) => {\n\tconst mod = await import(${JSON.stringify(appEntrypoint)});\n\n\tif ('default' in mod) {\n\t\tawait mod.default(app);\n\t} else {\n\t\t${\n\t\t\t!isBuild\n\t\t\t\t? `console.warn(\"[@astrojs/vue] appEntrypoint \\`\" + ${JSON.stringify(\n\t\t\t\t\t\tappEntrypoint,\n\t\t\t\t\t)} + \"\\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.\");`\n\t\t\t\t: ''\n\t\t}\n\t}\n}`;\n\t\t\t\t}\n\t\t\t\treturn `export const setup = () => {};`;\n\t\t\t},\n\t\t},\n\t\t// Ensure that Vue components reference appEntrypoint directly\n\t\t// This allows Astro to associate global styles imported in this file\n\t\t// with the pages they should be injected to\n\t\ttransform: {\n\t\t\tfilter: {\n\t\t\t\tid: /\\.vue$/,\n\t\t\t},\n\t\t\thandler(code) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/integrations/vue/src/index.ts#L61-L97","documentation":"When you configure the Vue integration with `appEntrypoint` (e.g. `vue({ appEntrypoint: '/src/app.ts' })`), the integration generates a virtual module whose `setup(app)` dynamically imports your entry and calls its default export (packages/integrations/vue/src/index.ts:69-85). If the module has no `default` export, the generated code logs this console.warn — but only when `!isBuild`, i.e. in `astro dev`/`astro preview`; production builds compile the branch out entirely. Consequence: your Vue app instance never receives the setup call (plugins, global components, directives from that file are never installed), and in production it fails silently — so treat the dev warning as a real bug, not noise.","triggerScenarios":"Configuring `appEntrypoint` in the Vue integration options while the target module exports only named exports (e.g. `export function setupApp()` or `export const plugins = [...]`) instead of `export default`. Opening any page in `astro dev` that instantiates the Vue app triggers the warn from the generated virtual module.","commonSituations":"Following the appEntrypoint guide but writing `export function ...` out of habit or per an older example; refactoring the entry file and dropping the `default` keyword; TypeScript files where `export default defineApp(...)` was changed to a named export during a lint autofix or codemod; splitting the entry into multiple files so the imported module no longer has a default.","solutions":["Add a default export that accepts the Vue app and performs the setup: `export default function (app) { app.use(router); app.component(...); }`.","Verify you're pointing `appEntrypoint` at the intended file (absolute path from project root, e.g. '/src/app.ts') — a typo can resolve to a helper module with no default export.","If the entry legitimately has no setup to run, remove the `appEntrypoint` option entirely so the integration uses the no-op `setup = () => {}` path instead of warning.","Confirm global plugins/components render in both dev and a production build, since production silently skips the missing default."],"exampleFix":"// before: src/app.ts\nimport { myPlugin } from './plugin';\nexport function setupApp(app) {\n  app.use(myPlugin);\n}\n\n// after: src/app.ts\nimport { myPlugin } from './plugin';\nexport default function setupApp(app) {\n  app.use(myPlugin);\n}","handlingStrategy":"validation","validationCode":"// verify the appEntrypoint module exposes a default export function before wiring it\nconst spec = '/src/app.ts'; // must match the vue({ appEntrypoint }) option\nconst mod = await import(spec);\nif (typeof mod.default !== 'function') {\n  throw new Error(`${spec} must export a default function (app) => void`);\n}","typeGuard":"// narrows a dynamic import result to a usable Vue app entry\ntype VueAppEntry = { default: (app: unknown) => void | Promise<void> };\nconst isVueAppEntry = (m: unknown): m is VueAppEntry =>\n  typeof m === 'object' && m !== null && typeof (m as { default?: unknown }).default === 'function';","tryCatchPattern":null,"preventionTips":["Treat this dev-only warn as a hard error: production builds compile it out, so a missing default export ships silently broken (no plugins/components registered).","Write the appEntrypoint file from a template that always ends with `export default function (app) { ... }` so refactors don't drop the default keyword.","Add a unit test that dynamically imports the appEntrypoint and asserts `typeof mod.default === 'function'` so CI catches the regression even though `astro build` never warns."],"tags":["vue","app-entrypoint","default-export","dev-only-warning","astro-integration"],"backgroundTag":"missing-default-export","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}