vite-ssg
vite-ssg copied to clipboard
createApp is not a function
D:\Assemble\src\core-vue-app\src\vue-frontend-app\node_modules\vite-ssg\dist\chunks\build.cjs:173 const { routes } = await createApp(false); ^
TypeError: createApp is not a function
at Object.build (D:\Assemble\src\core-vue-app\src\vue-frontend-app\node_modules\vite-ssg\dist\chunks\build.cjs:173:28)
at async Object.handler (D:\Assemble\src\core-vue-app\src\vue-frontend-app\node_modules\vite-ssg\dist\node\cli.cjs:25:3)
PS D:\Assemble\src\core-vue-app\src\vue-frontend-app>
I had the same problem. Change:
const createApp = ViteSSG(/* Your config */);
export default createApp;
to:
export const createApp = ViteSSG(/* Your config */);
I have this issue but I was already exporting createApp
as a named variable in main.ts.
I believe the right solution is to include the following in your vite.config.ts
:
ssr: {
// TODO: workaround until they support native ESM
noExternal: ['workbox-window', /vue-i18n/],
},
Please check your first of type module script, vite-ssg will use it as an entry.
https://github.com/antfu/vite-ssg/blob/7ef969c0e8e96e0dd4915f8c9aacb006a94e7a9d/src/node/build.ts#L237-L248
We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.