Skip to content

TypeError: Cannot read property 'isPure' of null #790

Description

@jy95

Input Code

Repo : https://github.com/jy95/torrent-files-library/tree/5b771ae69dd9b796b30a1147bedc25cd085af09d
Changes not commited : Just added "babel-preset-minify": "^0.3.0" in my package.json and updated my .babelrc.js like this

let env = process.env.BABEL_ENV || process.env.NODE_ENV;
let presets = [];
let plugins = ["@babel/plugin-proposal-object-rest-spread"];
let ignore = ["src/docs/**/*.js"];
let comments = false;

// custom settings for prod/test ; for example babel-istanbul-plugin , etc.
switch (env){
  case 'test':
    // ./fix-coverage/arrow-function-coverage-fix.js : Because some odd issue for istanbul/nyc
    plugins.push.apply(plugins, ["./fix-coverage/arrow-function-coverage-fix.js", "babel-plugin-istanbul"]);
    break;

  case 'production':
    presets.push.apply(presets, ['minify']);
    break;
}

// default preset
presets.push.apply(presets, ["@babel/preset-env"]);

module.exports = {
  presets: presets,
  plugins: plugins,
  ignore: ignore,
  comments: comments,
};

Command to run production build

npm run prepare

Actual Output

TypeError: Cannot read property 'isPure' of null
    at Object.checkPath (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\lib\virtual-types.js:120:23)
    at NodePath.(anonymous function) [as isPure] (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\index.js:226:24)
    at isPureAndUndefined (D:\workspaceNodeJs\torrent-files-library\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:21:13)
    at PluginPass.VariableDeclaration (D:\workspaceNodeJs\torrent-files-library\node_modules\babel-plugin-transform-remove-undefined\lib\index.js:216:21)
    at newFn (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\visitors.js:223:21)
    at NodePath._call (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:64:19)
    at NodePath.call (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:38:17)
    at NodePath.visit (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\path\context.js:99:12)
    at TraversalContext.visitQueue (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\context.js:139:18)
    at TraversalContext.visitMultiple (D:\workspaceNodeJs\torrent-files-library\node_modules\@babel\traverse\lib\context.js:93:17)

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bugneeds infoThe details mentioned are NOT clear or NOT enough. Please provide more information.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions