通过添加 Build System 的方式来使 Sublime Text 3 运行 JS、ES6:

参考文章:如何优雅地使用Sublime Text3

参考书目:《ES6标准入门》阮一峰

摘抄:

  1. 下载安装配置 NodeJS
  2. 在 Sublime 选择 Tools->Build System->New Build System...
  3. 编辑,命名(如 Node.sublime-build)并保存,位置默认
    {
    "cmd": [
    "node",
    "--use-strict",
    "--harmony",
    "$file"
    ],
    "selector": "source.js"
    }
  4. 在 Sublime 中选择 Tools->Build System->Node,编写完JS文件后保存 Ctrl + B 即可。
  5. 遇到类似于 SyntaxError: Unexpected token import 的错误,可以使用阮一峰老师写的 ES-Checker 模块检查运行环境对ES6的支持情况,如:
    C:\Users\Username>es-checker
    
    ECMAScript  Feature Detection (v1.3.0)
    
    Variables
    √ let and const
    √ TDZ error for too-early access of let or const declarations
    √ Redefinition of const declarations not allowed
    × destructuring assignments/declarations for arrays and objects
    × ... operator Data Types
    √ For...0f loop
    √ Map, Set, WeakMap, WeakSet
    √ Symbol
    √ Symbols cannot be implicitly coerced Number
    √ Octal (e.g. 0o1 ) and binary (e.g. 0b10 ) literal forms
    √ Old octal literal invalid now (e.g. )
    √ Static functions added to Math (e.g. Math.hypot(), Math.acosh(), Math.imul() )
    √ Static functions added to Number (Number.isNaN(), Number.isInteger() ) String
    √ Methods added to String.prototype (String.prototype.includes(), String.prototype.repeat() )
    √ Unicode code-point escape form in string literals (e.g. \u{20BB7} )
    √ Unicode code-point escape form in identifier names (e.g. var \u{20BB7} = ; )
    × Unicode code-point escape form in regular expressions (e.g. var regexp = /\u{20BB7}/u; )
    × y flag for sticky regular expressions (e.g. /b/y )
    √ Template String Literals Function
    √ arrow function
    × default function parameter values
    × destructuring for function parameters
    × Inferences for function name property for anonymous functions
    × Tail-call optimization for function calls and recursion Array
    × Methods added to Array.prototype ([].fill(), [].find(), [].findIndex(), [].entries(), [].keys(), [].values() )
    √ Static functions added to Array (Array.from(), Array.of() )
    √ TypedArrays like Uint8Array, ArrayBuffer, Int8Array(), Int32Array(), Float64Array()
    √ Some Array methods (e.g. Int8Array.prototype.slice(), Int8Array.prototype.join(), Int8Array.prototype.forEach() ) added to the TypedArray prototypes
    × Some Array statics (e.g. Uint32Array.from(), Uint32Array.of() ) added to the TypedArray constructors Object
    √ __proto__ in object literal definition sets [[Prototype]] link
    × Static functions added to Object (Object.getOwnSymbolNames(), Object.assign() )
    √ Object Literal Computed Property
    √ Object Literal Property Shorthands
    × Proxies
    × Reflect Generator and Promise
    √ Generator function
    √ Promises Class
    √ Class
    √ super allowed in object methods
    √ class ABC extends Array { .. } Module
    × Module export command
    × Module import command =========================================
    Passes feature Dectations
    Your runtime supports % of ECMAScript
    =========================================

Sublime相关的更多相关文章

  1. sublime 相关配置

    安转插件:案例格式化HTML代码,需要安装插件,具体安装步骤如下: 1.打开菜单->首选项->插件控制,输入 install package 2.等待程序进入插件管理功能,再输入插件名称: ...

  2. sublime相关设置

    1.设置Sublime Text新标签页打开文件 "open_files_in_new_window": false,

  3. sublime相关资源

    Sublime Text 全程指南 http://zh.lucida.me/blog/sublime-text-complete-guide/ Sublime官网Package安装 https://p ...

  4. Mac Sublime 相关资源

    MAC上安装并破解最新SublimeText3103版本 http://blog.csdn.net/yanzi1225627/article/details/50703942 Mac版的Sublime ...

  5. ubuntu中下载sublime相关问题

    1.SublimeText3的安装 在网上搜索了一些ubuntu下关于sublime-text-3安装的方法,在这里针对自己尝试的情况进行反馈: 方法一(未成功): 在终端输入以下代码: sudo a ...

  6. sublime相关小技巧

    1.快速建立一个新文件:Ctrl+n 2.修改多个相同符号:Ctrl+D 3.建立语言后缀的文件保存,例如我想创建PHP的语言脚本,先按Ctrl+Shift+p,打开Command Palette,输 ...

  7. sublime 相关配置和快捷键

    1.安装package control  点击sublime的菜单栏 view->show console :现在打开了控制台, 这个控制台有上下两栏, 上面一栏会实时显示sublime执行了什 ...

  8. sublime相关操作

    装插件 1,安装过Package Control ctrl + shift + p 输入install package 选择 Package Control: Install Package 搜索自己 ...

  9. Sublime中开发Ruby

    Ruby:Sublime中开发Ruby需要注意的Encoding事项 目录 背景Sublime相关默认的文件存储编码:UTF8默认的输出控制台编码:UTF8修改默认的输出控制台编码Ruby相关默认的代 ...

随机推荐

  1. 一个nginx匹配很诡异的问题

    nginx配置如下: location ~ \.php$ { root /opt/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index inde ...

  2. 注解的方式搭建springmvc步骤

    1.cope   jar包到lib中 2.配置web.xml文件 <servlet> <servlet-name>springmvc</servlet-name> ...

  3. memcached SASLAUTH 启动

    1.环境描述: Linux 服务器,memcached1.4.5 登录linux的用户名tuxedo,密码tuxedo 2.启动memcached sasl认证 p.p1 { margin: 0.0p ...

  4. Android实现文章+评论(MVP,RxJava,Dagger2,ButterKnife)

    简介 这个项目主要有两个功能,一个加载网页/文章,另一个用来显示评论.并应用了MVP模式,Dagger2.RxJava.ButterKnife等开源框架.效果图如下: 结构 首先来看一下布局文件: & ...

  5. CentOS6配置国内yum源

    在安装完CentOS后为了加快安装.更新rpm包的速度.需要将yum源改为国内源,国内比较快的源有中科大.163.sohu源.下面修改为163源为例子: 首先进入源的配置目录:执行 cd /etc/y ...

  6. 归并排序算法 java 实现

    归并排序算法 java 实现 可视化对比十多种排序算法(C#版) [直观学习排序算法] 视觉直观感受若干常用排序算法 算法概念 归并排序是建立在归并操作上的一种有效的排序算法,该算法是采用分治法(Di ...

  7. 学习笔记:MySQL列属性

    列属性 a)         null|not null 缺省值是null,也就是允许为空,如果是not null而又没有给该字段赋值的话,系统会首先查询该字段有没有默认值 b)         de ...

  8. HTML5 input placeholder 颜色修改

    在开发中遇到的一个小问题,记录下来./*placehodel*/ input:-ms-input-placeholder{color:#a9a9a9;}/* Internet Explorer 10+ ...

  9. Redis的Replication(复制)

    文件并发(日志处理)--队列--Redis+Log4Net 分布式中使用Redis实现Session共享(二) http://www.cnblogs.com/stephen-liu74/archive ...

  10. c++调用lua注册的带参数的回调

    main.cpp int lua_cb = LUA_REFNIL; int lua_cb_arg = LUA_REFNIL; int setcb(lua_State *L) { lua_pushval ...