Skip to content

Commit

Permalink
Merge pull request #53 from zhengxs2018/build-inline-dynamic-imports
Browse files Browse the repository at this point in the history
build(extension): inline dynamic imports
  • Loading branch information
phodal authored Jun 2, 2024
2 parents c9d1584 + c813164 commit 758c3f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@
"typescript": "^5.4.4",
"vite": "^5.2.8",
"vite-plugin-checker": "^0.6.4",
"vite-plugin-dts": "^3.8.1",
"vite-plugin-externalize-deps": "^0.8.0",
"vite-plugin-static-copy": "^1.0.2",
"vitest": "^1.4.0"
Expand Down
21 changes: 12 additions & 9 deletions vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// <reference types="vitest" />
import path from "node:path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import { defineConfig } from "vitest/config";
import { externalizeDeps } from "vite-plugin-externalize-deps";
import { viteStaticCopy } from "vite-plugin-static-copy";

Expand All @@ -15,15 +13,17 @@ export default defineConfig((api) => {
// hack bindings of sqlite3
bindings: path.join(__dirname, "vendors/bindings/index.js"),
// hack onnxruntime-node
'onnxruntime-node': path.join(__dirname, "vendors/onnxruntime-node/index.cjs")
"onnxruntime-node": path.join(
__dirname,
"vendors/onnxruntime-node/index.cjs"
),
},
},
plugins: [
externalizeDeps({
deps: false,
include: ["vscode"],
}),
isDev && dts(),
viteStaticCopy({
targets: [
{
Expand Down Expand Up @@ -81,10 +81,13 @@ export default defineConfig((api) => {
commonjsOptions: {
ignoreDynamicRequires: true,
dynamicRequireRoot: "/",
dynamicRequireTargets: [
'./bin/napi-v3/**/onnxruntime_binding.node'
],
}
dynamicRequireTargets: ["./bin/napi-v3/**/onnxruntime_binding.node"],
},
rollupOptions: {
output: {
inlineDynamicImports: true,
},
},
},
test: {
include: ["src/test/**/*.test.ts"],
Expand Down

0 comments on commit 758c3f0

Please sign in to comment.