Skip to content

Commit

Permalink
fix: fix filename too lang can not set to element attribute name error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoluoboding committed May 12, 2021
1 parent 3dc490d commit 88ebe08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sfc-compiler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SFCDescriptor, BindingMetadata } from '@vue/compiler-sfc'
import * as defaultCompiler from '@vue/compiler-sfc/dist/compiler-sfc.esm-browser' // production use
// import * as defaultCompiler from '@vue/compiler-sfc' // development use
// import * as defaultCompiler from '@vue/compiler-sfc/dist/compiler-sfc.esm-browser' // production use
import * as defaultCompiler from '@vue/compiler-sfc' // development use

import { File, recordFileErrors } from './store'

Expand Down Expand Up @@ -29,12 +29,12 @@ export async function compileFile({ filename, code, compiled }: File) {
return
}

const id = Buffer.from(filename).toString('base64')
console.log(id)
const id = Buffer.from(filename).toString('base64').slice(0, 16)
const { errors, descriptor } = SFCCompiler.parse(code, {
filename,
sourceMap: true
})
// console.log(descriptor)
if (errors.length) {
compiled.errors = errors
return
Expand Down
6 changes: 6 additions & 0 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export const WELCOME_CODE = `<template>
<script setup>
const msg = 'Hello World!'
</script>
<style scoped>
h1 {
font-size: 2em;
}
</style>
`.trim()

export const MAIN_CODE = getMainCode(APP_FILE)
Expand Down

0 comments on commit 88ebe08

Please sign in to comment.