mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
### Description
<!-- Describe your changes. -->
This PR allows to build ORT web to `ort{.all|.webgpu}.bundle.min.mjs`,
which does not have any dynamic import. This makes it possible to use
ort web via static import in service worker.
Fixes #20876
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
|
|
/**
|
|
* The interface BuildDefinitions contains a set of flags which are defined at build time.
|
|
*
|
|
* Those flags are processed in bundler for tree shaking to remove unused code.
|
|
* No flags in this file should present in production build.
|
|
*/
|
|
interface BuildDefinitions {
|
|
// #region Build definitions for Tree Shaking
|
|
|
|
/**
|
|
* defines whether to disable the whole WebGL backend in the build.
|
|
*/
|
|
readonly DISABLE_WEBGL: boolean;
|
|
/**
|
|
* defines whether to disable the whole WebGpu/WebNN backend in the build.
|
|
*/
|
|
readonly DISABLE_JSEP: boolean;
|
|
/**
|
|
* defines whether to disable the whole WebNN backend in the build.
|
|
*/
|
|
readonly DISABLE_WASM: boolean;
|
|
/**
|
|
* defines whether to disable proxy feature in WebAssembly backend in the build.
|
|
*/
|
|
readonly DISABLE_WASM_PROXY: boolean;
|
|
/**
|
|
* defines whether to disable training APIs in WebAssembly backend.
|
|
*/
|
|
readonly DISABLE_TRAINING: boolean;
|
|
/**
|
|
* defines whether to disable dynamic importing WASM module in the build.
|
|
*/
|
|
readonly DISABLE_DYNAMIC_IMPORT: boolean;
|
|
|
|
// #endregion
|
|
|
|
// #region Build definitions for ESM
|
|
|
|
/**
|
|
* defines whether the build is ESM.
|
|
*/
|
|
readonly IS_ESM: boolean;
|
|
/**
|
|
* placeholder for the import.meta.url in ESM. in CJS, this is undefined.
|
|
*/
|
|
readonly ESM_IMPORT_META_URL: string|undefined;
|
|
|
|
// #endregion
|
|
}
|
|
|
|
declare const BUILD_DEFS: BuildDefinitions;
|