Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(merge-sibling-var): recalculate declarations when concatenating variables #826

Merged
merged 1 commit into from May 1, 2018

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Apr 30, 2018

@frudman
Copy link

frudman commented May 1, 2018

Thanks for all that work!

Silly question but how do I get that update on our servers? I tried npm update babel-minify but still at version 0.4.0 and bug still present. Is there a special pull request for this?

@boopathi
Copy link
Member

boopathi commented May 1, 2018

There is a canary version published for every commit to master - You can try the canary version out and the docs for the same are here - https://github.com/babel/minify/tree/master/docs#canary-version

@frudman
Copy link

frudman commented May 2, 2018

so I had tried that and it's not working. This is what I have:

using npm view babel-minify I got:

babel-minify@0.4.0 | MIT | deps: 6 | versions: 55
✂️ An ES6+ aware minifier based on the Babel toolchain (beta)
https://github.com/babel/minify#readme

keywords: babel-minify, babel-preset, minify

bin: babel-minify, minify

dist
.tarball https://registry.npmjs.org/babel-minify/-/babel-minify-0.4.0.tgz
.shasum: c3da754336ac1b1b2b8e0f438adcc788b43c934b
.unpackedSize: 23.8 kB

dependencies:
@babel/core: ^7.0.0-beta.40  babel-preset-minify: ^0.4.0  fs-readdir-recursive: ^1.1.0 mkdirp: ^0.5.1               util.promisify: ^1.0.0       yargs-parser: ^9.0.2         

maintainers:
- babeljs <asciiguyfieri@gmail.com>
- boopathi <me@boopathi.in>
- hzoo <hi@henryzoo.com>
- loganfsmyth <loganfsmyth@gmail.com>
- vignesh.shanmugam <vignesh.shanmugam22@gmail.com>

dist-tags:
canary: 0.5.0-alpha.8b905991  latest: 0.4.0                 

published 3 weeks ago by boopathi <me@boopathi.in>

I also tried npm view babel-preset-minify (not sure what's the difference) and got this:

babel-preset-minify@0.4.0 | MIT | deps: 23 | versions: 38
Babel preset for all minify plugins.
https://github.com/babel/minify#readme

keywords: babel-minify, babel-preset, minify

dist
.tarball https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.4.0.tgz
.shasum: 34e6077683362cdda7611d522e064e02c14137fb
.unpackedSize: 13.2 kB

dependencies:
babel-plugin-minify-builtins: ^0.4.0                         babel-plugin-transform-member-expression-literals: ^6.9.1    
babel-plugin-minify-constant-folding: ^0.4.0                 babel-plugin-transform-merge-sibling-variables: ^6.9.1       
babel-plugin-minify-dead-code-elimination: ^0.4.0            babel-plugin-transform-minify-booleans: ^6.9.1               
babel-plugin-minify-flip-comparisons: ^0.4.0                 babel-plugin-transform-property-literals: ^6.9.1             
babel-plugin-minify-guarded-expressions: ^0.4.0              babel-plugin-transform-regexp-constructors: ^0.4.0           
babel-plugin-minify-infinity: ^0.4.0                         babel-plugin-transform-remove-console: ^6.9.1                
babel-plugin-minify-mangle-names: ^0.4.0                     babel-plugin-transform-remove-debugger: ^6.9.1               
babel-plugin-minify-numeric-literals: ^0.4.0                 babel-plugin-transform-remove-undefined: ^0.4.0              
babel-plugin-minify-replace: ^0.4.0                          babel-plugin-transform-simplify-comparison-operators: ^6.9.1 
babel-plugin-minify-simplify: ^0.4.0                         babel-plugin-transform-undefined-to-void: ^6.9.1             
babel-plugin-minify-type-constructors: ^0.4.0                lodash.isplainobject: ^4.0.6                                 
babel-plugin-transform-inline-consecutive-adds: ^0.4.0       

maintainers:
- amasad <amjad.masad@gmail.com>
- babeljs <asciiguyfieri@gmail.com>
- boopathi <me@boopathi.in>
- hzoo <hi@henryzoo.com>
- jongleberry <jonathanrichardong@gmail.com>
- kangax <kangax@gmail.com>
- loganfsmyth <loganfsmyth@gmail.com>
- vignesh.shanmugam <vignesh.shanmugam22@gmail.com>

dist-tags:
canary: 0.5.0-alpha.8b905991  latest: 0.4.0                 

published 3 weeks ago by boopathi <me@boopathi.in>

And for this run BABEL_ENV=prod npx babel src.js I got this (same src as before):

'use strict';(function(){for(var b=1,c='';123>b;)c+='a',b+=10;var a='c '+navx;console.log(a)})();

@frudman
Copy link

frudman commented May 2, 2018

...of course, the output above was after npm install babel-[preset-]minify@canary...

on an unrelated note: is there a difference between babel-minify and babel-preset-minify? (I have both so I'm not sure which one is used in the run)

And just for reference, the package.json file is:

{
  "name": "test-enerx",
  "version": "1.0.0",
  "description": "",
  "main": "dst.js",
  "dependencies": {
    "babel-cli": "^6.26.0",
    "babel-minify": "^0.5.0-alpha.8b905991",
    "babel-preset-env": "^1.6.1",
    "babel-preset-minify": "^0.5.0-alpha.8b905991"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

@frudman
Copy link

frudman commented May 2, 2018

As a side note, it's not clear to me why the web-based minifier generates correct code.

I've including a link to it here

@boopathi
Copy link
Member

boopathi commented May 2, 2018

it's not clear to me why the web-based minifier generates correct code.

The REPL is not in sync with the master.

is there a difference between babel-minify and babel-preset-minify?

babel-preset-minify: The babel preset that one can use in their babelrc to apply the minify transformations

babel-minify: the Node API and a CLI that uses babel and babel-preset-minify to do the transformation.

regd. version

Can you run this and confirm if you're on 0.5.0-alpha?

# install the CLI
npm install babel-minify

# Get the version
./node_moduels/.bin/minify --version

# Should output 0.5.0-alpha.something

Create a new issue if you're facing issues in 0.5.0.

@frudman
Copy link

frudman commented May 3, 2018

sorry, just got this. had already seen that you'd upgraded to 0.4.1 and tried that and it WORKED!!!
I'm now going to try it on the real code and see if it compiles properly.
Thanks again for your effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Bug Fix Pull Request fixes a bug
Projects
None yet
3 participants