Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support esbuild option charset #190

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/builder/plugins/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { extname, relative } from "pathe";
import type { Plugin, PluginContext } from "rollup";
import { Loader, TransformResult, transform } from "esbuild";
import { Loader, TransformResult, Charset, transform } from "esbuild";
import { createFilter } from "@rollup/pluginutils";
import type { FilterPattern } from "@rollup/pluginutils";

Expand All @@ -16,6 +16,7 @@ export interface Options {
exclude?: FilterPattern
sourceMap?: boolean
minify?: boolean
charset?: Charset
target: string | string[]
jsxFactory?: string
jsxFragment?: string
Expand Down Expand Up @@ -82,6 +83,7 @@ export function esbuild (options: Options): Plugin {
loader,
target: options.target,
define: options.define,
charset: options.charset,
sourcemap: options.sourceMap,
sourcefile: id
});
Expand All @@ -97,7 +99,7 @@ export function esbuild (options: Options): Plugin {
},

async renderChunk (code, { fileName }) {
if (options.minify && !fileName.endsWith('.d.ts')) {
if (options.minify && !fileName.endsWith(".d.ts")) {
const result = await transform(code, {
loader: "js",
minify: true,
Expand Down