Skip to content

"Cannot read property 'start' of null" #630

@trisys3

Description

@trisys3

Whenever I try to run babel with the full babili preset, I get an error from babel-plugin-transform-remove-undefined:

events.js:160
      throw er; // Unhandled 'error' event
      ^
TypeError: app/app.js: Cannot read property 'start' of null
    at /path/to/project/node_modules/babel-plugin-transform-remove-undefined/lib/index.js:71:32
    at Array.some (native)
    at hasViolation (/path/to/project/node_modules/babel-plugin-transform-remove-undefined/lib/index.js:68:46)
    at PluginPass.VariableDeclaration (/path/to/project/node_modules/babel-plugin-transform-remove-undefined/lib/index.js:192:69)
    at newFn (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/context.js:103:17)
    at TraversalContext.visit (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/context.js:190:19)
    at Function.traverse.node (/path/to/project/node_modules/ec-core/node_modules/babel-traverse/lib/index.js:114:17)

I tried this with only babel-preset-env and babili. I am using so much ES6 that esprima does not know what to do without at least some plugins. I get "Invalid left-hand side in assignment".

I noticed that the referenced plugin, babel-plugin-transform-remove-undefined, is not in the list of plugins on the main babili README file, either in the main section or in the "Other" section, so I can just copy all the plugins in the main section and use the ones that I want from the "Other" section, and everything works fine. With npm 3, I can even do this without installing all the plugins individually, as long as I remember to install babili itself.

What is the plugin transform-remove-undefined, and why is it not in the plugin list on babili's README file? Is it not finished or deprecated, or is it an internal plugin that babili always uses?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bughas PRHas an open PR that fixes this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions