Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

edpx-babel

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edpx-babel

edp plugin of babel

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

edpx-babel

基于babel6的edp插件。

Install

$ npm i edpx-babel babel-preset-browser --save-dev

Usage

Webserver(edp-webserver-config.js)

var babel = require('edpx-babel/lib/babel-handler');

// 注意babel函数的参数是babel6的配置项目,所有参数都可以在babel官网上查到
// http://babeljs.io/docs/usage/options/
exports.getLocations = function () {
    
    return [
        {
            location: /\.js($|\?)/,
            handler: [
                babel({
                    presets: ['babel-preset-browser']
                })
            ]
        }    
    ];
};

Builder(edp-build-config.js)

var BabelProcessor = require('edpx-babel/lib/BabelProcessor');

// 注意babel函数的参数是babel6的配置项目,所有参数都可以在babel官网上查到
// http://babeljs.io/docs/usage/options/
exports.getProcessors = function () {
    
    var html2jsProcessor = new processors.Html2JsCompiler({
        files: ['*.es'],
         compileOptions: {
             presets: ['babel-preset-browser']
         }
    });
};

Options

项目使用的配置与babel6完全一致,可以参考babel6配置手册

推荐:

  • 如果需要兼容IE6-8之一:可以使用babel-preset-browser预设
  • 如果只需要兼容IE9+或者移动:可以使用babel-preset-mobile(TODO)

在ES6的特性选择上,babel-preset-browser会剔除所有依赖ES5的Getter/Setter或者getPrototypeOf函数的功能。其它特性是基本一致的。

FAQs

Package last updated on 02 Jun 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc