babel / babel/minify

TypeError: Cannot read property 'isPure' of null

Open
#790 8 comments 1 reaction 0 assignees View on GitHub
bug needs info
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

#### 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

```js
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
```sh
npm run prepare
```

#### Actual Output

```js
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.