Skip to content
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

Support custom vue compiler options in @astrojs/vue #3143

Merged
merged 4 commits into from
Apr 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adds support for passing options to @vitejs/plugin-vue
  • Loading branch information
Tony Sullivan committed Apr 19, 2022
commit 94077502dd6f151e84ed9c675fbc7436403a99fe
9 changes: 5 additions & 4 deletions packages/integrations/vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AstroIntegration, AstroRenderer } from 'astro';
import vue from '@vitejs/plugin-vue';
import type { Options } from '@vitejs/plugin-vue';

function getRenderer(): AstroRenderer {
return {
Expand All @@ -9,26 +10,26 @@ function getRenderer(): AstroRenderer {
};
}

function getViteConfiguration() {
function getViteConfiguration(options?: Options) {
return {
optimizeDeps: {
include: ['@astrojs/vue/client.js', 'vue'],
exclude: ['@astrojs/vue/server.js'],
},
plugins: [vue()],
plugins: [vue(options)],
ssr: {
external: ['@vue/server-renderer'],
},
};
}

export default function (): AstroIntegration {
export default function (options?: Options): AstroIntegration {
return {
name: '@astrojs/vue',
hooks: {
'astro:config:setup': ({ addRenderer, updateConfig }) => {
addRenderer(getRenderer());
updateConfig({ vite: getViteConfiguration() });
updateConfig({ vite: getViteConfiguration(options) });
},
},
};
Expand Down