Minify: error: Cannot read property 'isIfStatement' of null

Created on 16 May 2018  路  11Comments  路  Source: babel/minify

Bug Report

Current Behavior
babel-preset-minify
Cannot read property 'isIfStatement' of null

Input Code
https://github.com/eeve/test.v2

// module-a.js
export default function () {
    return 1;
}

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "debug": true,
        "useBuiltIns": "usage",
        "targets": {
          "node": 6
        }
      }
    ],
    "minify"
  ],
  "sourceMaps": "inline"
}

Environment

  • Babel version(s): v7.0.0-beta.47
  • Node/npm version: Node 8.9.4/npm 6.0.0
  • Monorepo: no
  • How you are using Babel: cli

Additional context/Screenshots
20180516111516.png

Most helpful comment

When will this be fixed on the main branch?

All 11 comments

This is fixed in #848.

You can try the master branch by installing the canary version - https://github.com/babel/minify/tree/master/docs#canary-version ..

I'm closing this issue now. If the issue still persists in the canary version, please comment here to reopen the issue.

this problem still exists in this module "babel-plugin-minify-constant-folding": "^0.4.3"

screen shot 2018-05-23 at 6 24 54 pm

Any news on this? I get the same error with "babel-plugin-minify-constant-folding": "^0.4.3"

edit: worked with yarn add babel-preset-minify@canary

Still the same issue for me. Please re-open.

Cannot read property 'isIfStatement' of null

    at evaluateBasedOnControlFlow (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/babel-helper-evaluate-path/lib/index.js:159:32)
    at evaluateIdentifier (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/babel-helper-evaluate-path/lib/index.js:117:26)
    at evaluate (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/babel-helper-evaluate-path/lib/index.js:19:12)
    at PluginPass.Expression (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/babel-plugin-minify-constant-folding/lib/index.js:165:21
)
    at PluginPass.newFn (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/visitors.js:230:17)
    at newFn (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/visitors.js:193:21)
    at NodePath._call (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/Users/swerner/Workspace/init/init-stopnet-display/node_modules/@babel/traverse/lib/context.js:118:16)

Had this issue with build, and can confirm working with:
yarn add babel-preset-minify@canary

babel-preset-minify@canary works in my case as well

When will this be fixed on the main branch?

Considering that the canary release is 0.5.0-beta.54, probably when 0.5.0 is released.

Same bug on last release, with canary all work fine

Am also experiencing this, can confirm it's been fixed on the canary

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Reinmar picture Reinmar  路  4Comments

Gustorn picture Gustorn  路  4Comments

jacobmischka picture jacobmischka  路  5Comments

marvinhagemeister picture marvinhagemeister  路  5Comments

hzoo picture hzoo  路  5Comments