
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@kokojs/plugin-esbuild
Advanced tools
`@kokojs/plugin-esbuild` 提供了基于 [esbuild](https://github.com/evanw/esbuild) 进行压缩的能力。
@kokojs/plugin-esbuild 提供了基于 esbuild 进行压缩的能力。
yarn add @kokojs/plugin-esbuild --dev
安装完成后,在 koko.config.js 中添加如下配置:
module.exports = {
plugins: {
esbuild: {},
},
};
ESBuild 是使用 Go 语言编写的 JavaScript bundler & minifier,它的特点是构建速度极快,相比 Terser 有数十倍的提升。
在大型工程中使用本插件,可以大幅度减少编译所需的时间。
Booleantrue是否在 build 时使用 ESBuild 进行代码压缩,开启此选项时,会替换 Webpack 默认的 Terser 压缩。
'dev' | 'build' | 'all' | 'none''none'是否通过 esbuild-loader 来编译 JS/TS 代码。
dev 时,表示仅在 dev 模式下开启(推荐使用)build 时,表示仅在 build 模式下开启all 时,会在 dev & build 模式下开启none 时,表示不开启// koko.config.js
module.exports = {
plugins: {
// 在 dev 时使用 esbuild
esbuild: {
scriptTranspile: 'dev',
},
// 在 build 时使用 babel
babel: {
scriptTranspile: 'build',
},
},
};
ESBuild 压缩结果中会产生 ES6 语法,比如模板字符串,在使用时请考虑业务对兼容性的要求,不建议在 C 端业务中使用。
另外,在使用 ESBuild 插件时,一般需要关闭 ES Guard 插件。
module.exports = {
plugins: {
'es-guard': {
enable: false,
},
},
};
陈嘉涵。
FAQs
`@kokojs/plugin-esbuild` 提供了基于 [esbuild](https://github.com/evanw/esbuild) 进行压缩的能力。
The npm package @kokojs/plugin-esbuild receives a total of 390 weekly downloads. As such, @kokojs/plugin-esbuild popularity was classified as not popular.
We found that @kokojs/plugin-esbuild demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.