Skip to content

Commit

Permalink
Support custom vue compiler options in @astrojs/vue (withastro#3143)
Browse files Browse the repository at this point in the history
* adds support for passing options to @vitejs/plugin-vue

* updating vue integration README with options details

* adding a tests for custom vue compiler options

* chore: adding changeset
  • Loading branch information
Tony Sullivan committed Apr 19, 2022
1 parent 6bc3189 commit f06e24a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/fixtures/vue-component/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ import vue from '@astrojs/vue';

// https://astro.build/config
export default defineConfig({
integrations: [vue()],
integrations: [vue({
template: {
compilerOptions: {
isCustomElement: tag => tag.includes('my-button')
}
}
})],
});
1 change: 1 addition & 0 deletions test/fixtures/vue-component/src/components/Result.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<pre>{{ value }}</pre>
<my-button>Click Me</my-button>
</template>

<script>
Expand Down
3 changes: 3 additions & 0 deletions test/vue-component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ describe('Vue component', () => {
// test 3: all <astro-root>s have uid attributes
expect($('astro-root[uid]')).to.have.lengthOf(6);

// test 4: treats <my-button> as a custom element
expect($('my-button')).to.have.lengthOf(7);

// test 5: components with identical render output and props have been deduplicated
const uniqueRootUIDs = $('astro-root').map((i, el) => $(el).attr('uid'));
expect(new Set(uniqueRootUIDs).size).to.equal(5);
Expand Down

0 comments on commit f06e24a

Please sign in to comment.