Skip to content

Commit

Permalink
feat: optimize package size for web
Browse files Browse the repository at this point in the history
  • Loading branch information
2214962083 committed Jul 3, 2023
1 parent 0a23406 commit 51ddeec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/gpt-runner-cli/src/cli-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { version } from '../package.json'
import type { CliOptions } from './types'

const dirname = PathUtils.getCurrentDirName(import.meta.url, () => __dirname)
const startServerJsPath = PathUtils.resolve(dirname, '../node_modules/@nicepkg/gpt-runner-web/dist/start-server.mjs')
const startServerJsPath = PathUtils.resolve(dirname, '../node_modules/@nicepkg/gpt-runner-web/dist/start-server.cjs')

export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = process.argv, options: CliOptions = {}) {
const cli = cac('gptr')
Expand Down
3 changes: 3 additions & 0 deletions packages/gpt-runner-web/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ ${output.banner || ''}
`
}
})

// remove esm
rollupOptions.output = rollupOptions.output.filter(output => output.format !== 'esm')
},
},
})
13 changes: 4 additions & 9 deletions packages/gpt-runner-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,23 @@
"exports": {
".": {
"types": "./dist/common/index.d.ts",
"require": "./dist/common.cjs",
"import": "./dist/common.mjs"
"require": "./dist/common.cjs"
},
"./*": "./*",
"./server": {
"types": "./dist/server/index.d.ts",
"require": "./dist/server.cjs",
"import": "./dist/server.mjs"
"require": "./dist/server.cjs"
},
"./start-server": {
"types": "./dist/server/start-server.d.ts",
"require": "./dist/start-server.cjs",
"import": "./dist/start-server.mjs"
"require": "./dist/start-server.cjs"
},
"./common": {
"types": "./dist/common/index.d.ts",
"require": "./dist/common.cjs",
"import": "./dist/common.mjs"
"require": "./dist/common.cjs"
}
},
"main": "dist/common.cjs",
"module": "dist/common.mjs",
"types": "./dist/common/index.d.ts",
"files": [
"dist/",
Expand Down

0 comments on commit 51ddeec

Please sign in to comment.