Skip to content

Commit

Permalink
fix: correct esbuild loader
Browse files Browse the repository at this point in the history
  • Loading branch information
yejimeiming committed Jun 25, 2023
1 parent ef781ec commit 23b7cdf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
@@ -1,6 +1,7 @@
import fs from 'node:fs'
import path from 'node:path'
import type { Plugin, ResolvedConfig } from 'vite'
import type { Loader } from 'esbuild'
import { parse as parseAst } from 'acorn'
import {
DEFAULT_EXTENSIONS,
Expand Down Expand Up @@ -85,7 +86,10 @@ export default function commonjs(options: Options = {}): Plugin {
})

if (contents != null) {
return { contents }
return {
contents,
loader: id.slice(id.lastIndexOf('.') + 1) as Loader,
}
}
})
},
Expand Down

0 comments on commit 23b7cdf

Please sign in to comment.