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

fix: no style tag error #8

Merged
merged 2 commits into from
Dec 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default (): Plugin => {
contents += `__sfc_main.__scopeId = "data-v-${genId(args.path)}"\n`
}

contents += `export default __sfc_main`
contents += `\nexport default __sfc_main`
return {
contents,
resolveDir,
Expand Down
27 changes: 27 additions & 0 deletions test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@ export {
"
`;

exports[`simple: test/fixture/dist/setup-no-style.js 1`] = `
"// vue:./test/fixtures/setup-no-style.vue
import { defineComponent as _defineComponent } from \\"vue\\";
import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from \\"vue\\";
import { ref } from \\"vue\\";
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(\\"h1\\", null, \\"hi\\", -1);
var foo = \\"foo\\";
var __sfc_main = /* @__PURE__ */ _defineComponent({
setup(__props) {
const start = 1;
const count = ref(start);
return (_ctx, _cache) => {
return _openBlock(), _createElementBlock(_Fragment, null, [
_createElementVNode(\\"div\\", null, _toDisplayString(count.value), 1),
_hoisted_1
], 64);
};
}
});
var setup_no_style_default = __sfc_main;
export {
setup_no_style_default as default,
foo
};
"
`;

exports[`simple: test/fixture/dist/simple.css 1`] = `
"/* vue:./test/fixtures/simple.vue?vue&type=style */
div[data-v-525d9030] {
Expand Down
14 changes: 14 additions & 0 deletions test/fixtures/setup-no-style.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template>
<div>{{ count }}</div>
<h1>hi</h1>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const start: number = 1
const count = ref(start)
</script>

<script lang="ts">
export const foo = 'foo'
</script>
1 change: 1 addition & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test('simple', async () => {
entryPoints: [
'./test/fixtures/simple.vue',
'./test/fixtures/setup.vue',
'./test/fixtures/setup-no-style.vue',
'./test/fixtures/style-binding.vue',
],
plugins: [vue()],
Expand Down