chore: reduce bundle size (#1970)
* chore: reduce bundle size * chore: trimming langchainjs * chore: trim pdf-parse
This commit is contained in:
parent
bb11bc2933
commit
eb09399fbf
@ -11,7 +11,6 @@
|
||||
"productName": "Jan",
|
||||
"files": [
|
||||
"renderer/**/*",
|
||||
"build/*.{js,map}",
|
||||
"build/**/*.{js,map}",
|
||||
"pre-install",
|
||||
"models/**/*",
|
||||
@ -77,7 +76,6 @@
|
||||
"@janhq/core": "link:./core",
|
||||
"@janhq/server": "link:./server",
|
||||
"@npmcli/arborist": "^7.1.0",
|
||||
"@types/request": "^2.48.12",
|
||||
"@uiball/loaders": "^1.3.0",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
@ -86,8 +84,6 @@
|
||||
"pacote": "^17.0.4",
|
||||
"request": "^2.88.2",
|
||||
"request-progress": "^3.0.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.2.2",
|
||||
"ulid": "^2.3.0",
|
||||
"use-debounce": "^9.0.4"
|
||||
},
|
||||
@ -96,6 +92,7 @@
|
||||
"@playwright/test": "^1.38.1",
|
||||
"@types/npmcli__arborist": "^5.6.4",
|
||||
"@types/pacote": "^11.1.7",
|
||||
"@types/request": "^2.48.12",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"electron": "28.0.0",
|
||||
@ -103,7 +100,9 @@
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-playwright-helpers": "^1.6.0",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"run-script-os": "^1.1.6"
|
||||
"rimraf": "^5.0.5",
|
||||
"run-script-os": "^1.1.6",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"installConfig": {
|
||||
"hoistingLimits": "workspaces"
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
"author": "Jan <service@jan.ai>",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
|
||||
"clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550",
|
||||
"build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts",
|
||||
"build:publish:linux": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install",
|
||||
"build:publish:darwin": "rimraf *.tgz --glob && npm run build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install",
|
||||
"build:publish:win32": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install",
|
||||
@ -25,7 +26,7 @@
|
||||
"rollup-plugin-define": "^1.0.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript": "^5.2.2",
|
||||
"run-script-os": "^1.1.6"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -44,9 +45,6 @@
|
||||
],
|
||||
"bundleDependencies": [
|
||||
"@janhq/core",
|
||||
"@langchain/community",
|
||||
"hnswlib-node",
|
||||
"langchain",
|
||||
"pdf-parse"
|
||||
"hnswlib-node"
|
||||
]
|
||||
}
|
||||
|
||||
@ -48,9 +48,6 @@ export default [
|
||||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
|
||||
external: [
|
||||
"@janhq/core/node",
|
||||
"@langchain/community",
|
||||
"langchain",
|
||||
"langsmith",
|
||||
"path",
|
||||
"hnswlib-node",
|
||||
],
|
||||
|
||||
@ -17,12 +17,12 @@
|
||||
"cpx": "^1.5.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"webpack-cli": "^5.1.4",
|
||||
"ts-loader": "^9.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"path-browserify": "^1.0.1",
|
||||
"ts-loader": "^9.5.0"
|
||||
"path-browserify": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@ -35,12 +35,12 @@
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
"run-script-os": "^1.1.6",
|
||||
"typescript": "^5.2.2"
|
||||
"typescript": "^5.2.2",
|
||||
"@types/os-utils": "^0.0.4",
|
||||
"@rollup/plugin-replace": "^5.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@types/os-utils": "^0.0.4",
|
||||
"fetch-retry": "^5.0.6",
|
||||
"path-browserify": "^1.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
"cpx": "^1.5.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"webpack-cli": "^5.1.4",
|
||||
"ts-loader": "^9.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"fetch-retry": "^5.0.6",
|
||||
"path-browserify": "^1.0.1",
|
||||
"ts-loader": "^9.5.0",
|
||||
"ulid": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
"cpx": "^1.5.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"webpack-cli": "^5.1.4",
|
||||
"ts-loader": "^9.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"fetch-retry": "^5.0.6",
|
||||
"path-browserify": "^1.0.1",
|
||||
"ts-loader": "^9.5.0",
|
||||
"ulid": "^2.3.0",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
"cpx": "^1.5.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"webpack-cli": "^5.1.4",
|
||||
"ts-loader": "^9.5.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
@ -23,7 +24,6 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"path-browserify": "^1.0.1",
|
||||
"ts-loader": "^9.5.0"
|
||||
"path-browserify": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,12 +13,12 @@
|
||||
"devDependencies": {
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
"webpack-cli": "^5.1.4",
|
||||
"ts-loader": "^9.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@janhq/core": "file:../../core",
|
||||
"node-os-utils": "^1.3.7",
|
||||
"ts-loader": "^9.5.0"
|
||||
"node-os-utils": "^1.3.7"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB After Width: | Height: | Size: 229 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 MiB After Width: | Height: | Size: 356 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 352 KiB |
@ -10,7 +10,7 @@ const ExploreModelList: React.FC<Props> = ({ models }) => {
|
||||
const takenModelIds: string[] = []
|
||||
const featuredModels = models
|
||||
.filter((m) => {
|
||||
if (m.metadata.tags.includes('Featured')) {
|
||||
if (m.metadata?.tags?.includes('Featured')) {
|
||||
takenModelIds.push(m.id)
|
||||
return m
|
||||
}
|
||||
@ -19,7 +19,7 @@ const ExploreModelList: React.FC<Props> = ({ models }) => {
|
||||
|
||||
const recommendedModels = models
|
||||
.filter((m) => {
|
||||
if (m.metadata.tags.includes('Recommended')) {
|
||||
if (m.metadata?.tags?.includes('Recommended')) {
|
||||
takenModelIds.push(m.id)
|
||||
return m
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user