mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-29 23:06:41 +00:00
### Description
Use esbuild to accelerate bundle build.
This change uses esbuild to replace webpack for onnxruntime-web. Bundle
build time reduced from ~20sec to ~0.6sec on my windows dev box.
A few changes applied:
- import nodejs modules using "node:" prefix
- remove enum declaration inside namespace (EncoderUsage)
- use "fs/promise" to replace the old promisify from "util"
- separate ort-web and test-runner. Previously they are bundled
together, now they are built into 2 files.
- optimize karma runner launch time
- remove unnecessary sourcemap preprocessor. sourcemaps are handled
inside esbuild
- remove unnecessary proxies (because ort-web and test-runner are
separated now, the path are correctly inferred)
- remove file watcher for test data
- optimize special handling as esbuild plugins:
- polyfill dummy imports for node.js modules when targetting browser.
- load as content string for ort-wasm-*.worker.js
- load as content string for ./proxy-worker/main.ts
- a source patch to ort-wasm*-threaded*.js (see details in comments in
code)
- updated debug configurations for sourcemap mapping to ensure
out-of-box good dev experience
73 lines
2.3 KiB
JSON
73 lines
2.3 KiB
JSON
{
|
|
// Use IntelliSense to learn about possible attributes.
|
|
// Hover to view descriptions of existing attributes.
|
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
"version": "0.2.0",
|
|
"configurations": [
|
|
{
|
|
"name": "[common] Launch Unit Tests in Node.js",
|
|
"args": ["-u", "bdd", "--timeout", "999999", "--colors", "${workspaceFolder}/common/test/**/*.js"],
|
|
"internalConsoleOptions": "openOnSessionStart",
|
|
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
"cwd": "${workspaceFolder}/common",
|
|
"request": "launch",
|
|
"skipFiles": ["<node_internals>/**"],
|
|
"type": "node",
|
|
"sourceMaps": true,
|
|
"preLaunchTask": "tsc: build - common/test/tsconfig.json"
|
|
},
|
|
{
|
|
"name": "[web] Launch Test Runner CLI in Node.js",
|
|
"program": "${workspaceFolder}/web/script/test-runner-cli.js",
|
|
"request": "launch",
|
|
"skipFiles": ["<node_internals>/**"],
|
|
"type": "node",
|
|
"cwd": "${workspaceFolder}/web",
|
|
"args": ["suite1"]
|
|
},
|
|
{
|
|
"name": "[web] Launch NPM tests in Node.js",
|
|
"args": [
|
|
"--timeout",
|
|
"999999",
|
|
"--colors",
|
|
"-r",
|
|
"${workspaceFolder}/web/dist/ort.node.min.js",
|
|
"${workspaceFolder}/web/test/test-main"
|
|
],
|
|
"internalConsoleOptions": "openOnSessionStart",
|
|
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
"request": "launch",
|
|
"skipFiles": ["<node_internals>/**"],
|
|
"type": "node",
|
|
"cwd": "${workspaceFolder}/web"
|
|
},
|
|
{
|
|
"name": "[web] Attach to Chrome for NPM tests",
|
|
"type": "chrome",
|
|
"request": "attach",
|
|
"port": 9333,
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMapPathOverrides": {
|
|
"../../common/*": "${webRoot}/common/*",
|
|
"../lib/*": "${webRoot}/web/lib/*"
|
|
},
|
|
"sourceMaps": true,
|
|
"smartStep": true,
|
|
"skipFiles": ["**/node_modules/**"]
|
|
},
|
|
{
|
|
"name": "[web] Remote Browser via Webkit Adaptor",
|
|
"type": "chrome",
|
|
"request": "attach",
|
|
"port": 9000,
|
|
"webRoot": "${workspaceFolder}",
|
|
"sourceMapPathOverrides": {
|
|
"webpack://ort/*": "${webRoot}/common/*",
|
|
"webpack:///*": "${webRoot}/web/*"
|
|
},
|
|
"sourceMaps": true,
|
|
"smartStep": true
|
|
}
|
|
]
|
|
}
|