feat: add build.target option (#1798)

This commit is contained in:
Marvin Hagemeister
2023-09-20 11:05:46 +02:00
committed by GitHub
parent 3fd8fe89d3
commit 0c37b5f9b9
11 changed files with 106 additions and 1 deletions
+1
View File
@@ -61,6 +61,7 @@ export async function getFreshConfigWithDefaults(
manifest,
build: {
outDir: "",
target: opts.build?.target ?? ["chrome99", "firefox99", "safari15"],
},
plugins: opts.plugins ?? [],
staticDir: "",
+3
View File
@@ -382,6 +382,7 @@ export async function getServerContext(opts: InternalFreshOptions) {
jsxConfig,
opts.dev,
opts.router ?? DEFAULT_ROUTER_OPTIONS,
opts.build.target,
snapshot,
);
}
@@ -416,6 +417,7 @@ export class ServerContext {
jsxConfig: JSXConfig,
dev: boolean,
routerOptions: RouterOptions,
target: string | string[],
snapshot: BuildSnapshot | null = null,
) {
this.#routes = routes;
@@ -435,6 +437,7 @@ export class ServerContext {
configPath,
dev: this.#dev,
jsxConfig,
target,
});
this.#routerOptions = routerOptions;
}
+8
View File
@@ -32,6 +32,13 @@ export interface FreshOptions {
* This can be an absolute path, a file URL or a relative path.
*/
outDir?: string;
/**
* This sets the target environment for the generated code. Newer
* language constructs will be transformed to match the specified
* support range. See https://esbuild.github.io/api/#target
* @default {"es2022"}
*/
target?: string | string[];
};
render?: RenderFunction;
plugins?: Plugin[];
@@ -47,6 +54,7 @@ export interface InternalFreshOptions {
manifest: Manifest;
build: {
outDir: string;
target: string | string[];
};
render?: RenderFunction;
plugins: Plugin[];