Skip to content
Open
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
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export interface Options {
// customElement?: boolean | string | RegExp | (string | RegExp)[]
// reactivityTransform?: boolean | string | RegExp | (string | RegExp)[]
compiler?: typeof _compiler

/**
* The options for esbuild to transform script code
* @default 'esnext'
* @example 'esnext' | ['esnext','chrome58','firefox57','safari11','edge16','node12']
*/
target?: string | string[]
}

export interface ResolvedOptions extends Options {
Expand All @@ -55,6 +62,7 @@ export interface ResolvedOptions extends Options {
cssDevSourcemap: boolean
devServer?: ViteDevServer
devToolsEnabled?: boolean
target: string | string[]
}

export default function vuePlugin(rawOptions: Options = {}): Plugin {
Expand All @@ -78,7 +86,8 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
root: process.cwd(),
sourceMap: true,
cssDevSourcemap: false,
devToolsEnabled: process.env.NODE_ENV !== 'production'
devToolsEnabled: process.env.NODE_ENV !== 'production',
target: rawOptions.target ?? 'esnext'
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ var __component__ = /*#__PURE__*/__normalizer(
filename,
{
loader: 'ts',
target: 'esnext',
target: options.target,
sourcemap: options.sourceMap
},
resolvedMap
Expand Down