Giter VIP home page Giter VIP logo

babel-minify's Issues

[mangle] vars in blocks

{
  var x = 5;
  function a() {}
}
var x = 6;

returns

{ var b = 5; function b() {} } var a = 6;

The function name a(or something that the mangler will assign) gives this error, doesn't happen for other function names.

Perf

As an example, I tried unminified React code on Chrome Canary with the browser version of the minifier and the time taken was around 19s in the worker thread.

  • Calculate individual plugins perf ?

[mangle] global var a

When a global var already exists, there is no binding, and mangler fails to check this.

var x = 1;
var y = a + 1;

and the output is

var a=1,b=a+1;

not applied babel plugins

Hi, i have problem when i transpiling es6 with using babel-preset-min and plugins babel-add-module-exports

src/index.js

export default (tree, a = {}) => {
    console.log(a, tree);
    return () => {};
};

babel config

"babel": {
    "presets": [
      "es2015",
      "min"
    ],
    "plugins": [
      "add-module-exports"
    ],
    "comments": true,
    "compact": true,
    "minified": true
  }

after run $ babel src/ -d lib/ i get:

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.default=function(b){var c=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];console.log(c,b);return function(){}};

see in end line

else run without presets min i get:

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(tree){var a=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];console.log(a,tree);return function(){}};module.exports=exports["default"];

see in end line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.