Skip to content

Commit c1bb967

Browse files
authored
Merge pull request #9 from lowet84/custom_compilerOptions
Add support for custom compilerOptions for vue sfc.
2 parents 8ea44e6 + 31a5106 commit c1bb967

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ const vuePlugin = (opts: Options = {}) => <esbuild.Plugin>{
218218
compilerOptions: {
219219
inSSR: opts.renderSSR,
220220
directiveTransforms: transforms,
221-
bindingMetadata: script?.bindings
221+
bindingMetadata: script?.bindings,
222+
...opts.compilerOptions
222223
}
223224
});
224225

@@ -239,7 +240,7 @@ const vuePlugin = (opts: Options = {}) => <esbuild.Plugin>{
239240
return {
240241
contents: result.code,
241242
warnings: result.tips.map(o => ({ text: o })),
242-
loader: "js",
243+
loader: "ts",
243244
resolveDir: path.dirname(args.path),
244245
}
245246
}));

src/options.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DirectiveNode, ElementNode, TransformContext } from "@vue/compiler-core";
1+
import { CompilerOptions, DirectiveNode, ElementNode, TransformContext } from "@vue/compiler-core";
22
import { IndexOptions } from "./html";
33

44
export type Options = {
@@ -64,4 +64,9 @@ export type Options = {
6464
options?: any;
6565
plugins?: any[];
6666
}
67+
68+
/**
69+
* Option to add custom compiler options for vue sfc
70+
*/
71+
compilerOptions?: CompilerOptions
6772
}

0 commit comments

Comments
 (0)