Skip to content

Commit

Permalink
fix(vite): esbuild should be processed after vue-vine (#91)
Browse files Browse the repository at this point in the history
* fix(vite): esbuild should be processed after vue-vine
* chore: update ts code
  • Loading branch information
alexzhang1030 committed May 19, 2024
1 parent a31c12c commit dc7f6a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
4 changes: 4 additions & 0 deletions packages/playground/src/pages/home.vine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function OutsideExample(props: { id: string }) {
}, 2000)
}

const a = (a: string) => {

}

// Mock result of a network request
watch(() => props.id, () => {
mockUpdate()
Expand Down
28 changes: 1 addition & 27 deletions packages/vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,33 +92,7 @@ function createVinePlugin(options: VineCompilerOptions = {}): Plugin {

return {
name: 'vue-vine-plugin',
config(config) {
// We need to exclude vine files from esbuild
// because we don't want them to be transpiled to JS that early.
if (!config.esbuild) {
config.esbuild = {}
}

if (!config.esbuild.include) {
config.esbuild.exclude = [
/\.vine\.ts$/,
]
}
else if (
typeof config.esbuild.exclude === 'string'
|| config.esbuild.exclude instanceof RegExp
) {
// merge the original config value into an array
config.esbuild.exclude = [
config.esbuild.exclude,
/\.vine\.ts$/,
] as any
}
else if (Array.isArray(config.esbuild.exclude)) {
(config.esbuild.exclude as Array<(string | RegExp)>)
.push(/\.vine\.ts$/)
}
},
enforce: 'pre',
async resolveId(id) {
const { query } = parseQuery(id)
if (query.type === QUERY_TYPE_STYLE) {
Expand Down

0 comments on commit dc7f6a7

Please sign in to comment.