
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
babel-preset-miniprogram
Advanced tools
微信小程序 babel 构建环境预设
npm install --save-dev babel-preset-miniprogram
// babel.config.js
module.exports = {
presets: [
[
'babel-preset-miniprogram',
{
wechatLibVersion: '2.14.0', // 指定小程序最低基础库版本
useBuiltIns: 'usage', // 打入 Polyfill
modules: 'cjs', // 将代码转义为 commonjs
},
],
],
};
wechatLibVersion: string
指定构建小程序的目标最低基础库版本,可以在 小程序管理页 【设置】-【基本设置】-【基础库最低版本设置】中设置你的小程序最低版本
其余配置项可直接使用 @babel/preset-env
配置项
由于小程序基础库版本会与小程序运行环境版本绑定,因此特定小程序基础库可能的运行环境是确定的。
该预设便是利用该信息,只将运行环境必要的转义和 Polyfill 设置给 @babel/preset-env
,从而尽可能减少编译处理和小程序代码体积。
另外由于小程序基础库本身自带了一个 Polyfill,该预设也会避免打入不必要的 Polyfill。
FAQs
微信小程序 babel 构建环境预设
The npm package babel-preset-miniprogram receives a total of 6 weekly downloads. As such, babel-preset-miniprogram popularity was classified as not popular.
We found that babel-preset-miniprogram demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.