vercel / ncc

Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires.
https://npmjs.com/@vercel/ncc
MIT License
9.27k stars 291 forks source link

Are there multiple js files in the directory packaged by NCC? #1169

Open killghost opened 8 months ago

killghost commented 8 months ago

Are there multiple js files in the directory packaged by NCC?

const pinyins = await nccwpck_require.e(/ import() / 346).then(nccwpck_require.t.bind(__nccwpck_require__, 4346, 23));

index.js 346.index.js ​ Can anyone tell me why this is?

styfle commented 8 months ago

Could be an asset read like fs.readFile('./foo.js')

Also could be from --asset-builds flag.

killghost commented 8 months ago

import pinyin from "pinyin";

console.log(pinyin("中心")); // [ [ 'zhōng' ], [ 'xīn' ] ]

console.log(pinyin("中心", { heteronym: true, // 启用多音字模式 })); // [ [ 'zhōng', 'zhòng' ], [ 'xīn' ] ] consol

iuse this lib in typescript script project