惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
B
Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
P
Privacy International News Feed
L
LINUX DO - 最新话题
博客园_首页
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
C
Cisco Blogs
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
罗磊的独立博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
A
About on SuperTechFans
G
GRAHAM CLULEY
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
D
DataBreaches.Net
The Hacker News
The Hacker News
Spread Privacy
Spread Privacy
AWS News Blog
AWS News Blog
I
InfoQ
T
The Exploit Database - CXSecurity.com
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - 叶小钗
Project Zero
Project Zero

博客园 - follaw

知识点记录 websocket 入门 30分钟学会JS AST,打造自己的编译器 js 浅拷贝有大用 这么多小程序,会微信小程序就够了 2019年-感谢一路相随 2019年学习以及输出计划 不要让自己的技能沦为大众化 新年福利-领取2019前端学习资料和电子书 事件循环进阶:macrotask与microtask 放弃setInterval-说说定时器 从Event Loop谈JS的运行机制 css加载是否会阻塞dom树渲染 简单理解下浏览器渲染页面流程 浏览器内核中各个线程之间的关系 Browser进程和浏览器内核(Renderer进程)的通信过程 mac nvm install 小程序云开发补充 浏览器内核-渲染进程
babel 的一些记录
follaw · 2018-09-28 · via 博客园 - follaw

babel 的作用是将高版本的代码转换成低版本的可支持的代码;

过程是 读取 source code 转换为语法树 -》 经过处理 -》 转换为 code;

babel有preset和plugin,有啥作用和区别呢?

babel的代码的转换处理是通过plugin转换的,多个plugin执行顺序是从上到下;

presets是plugin的集合,不需要挨个的去写plugin了;

  • Plugin 会运行在 Preset 之前。
  • Plugin 会从第一个开始顺序执行。ordering is first to last.
  • Preset 的顺序则刚好相反(从最后一个逆序执行)。

babel的配置

是一个json结构,字段有presets和plugin ;

也支持env环境设置,是从process.env.BABEL_ENV 进行读取当前的环境变量,默认是development

{
    "env": {
        "production": {
            "presets": ["env","react"]
        },
        "development":{
            "presets": [
                "env",
                "react"
            ]
        }
    }
}

  待续。。。。。。