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

Cannot read property 'add' of undefined while parsing file #1036

Open
kumavis opened this issue Jun 3, 2022 · 1 comment
Open

Cannot read property 'add' of undefined while parsing file #1036

kumavis opened this issue Jun 3, 2022 · 1 comment

Comments

@kumavis
Copy link

kumavis commented Jun 3, 2022

Error during minification

Cannot read property 'add' of undefined while parsing file:

thrown here

const ref = this.references.get(parent);

while parsing this file
https://github.com/MetaMask/metamask-extension/blob/239f5f7fa60a05f3b98eb00a9bbb7d27ee48eed1/ui/helpers/utils/conversions.util.js

Expected Output

no error

Stack Trace

 /home/xyz/Development/metamask-extension/ui/helpers/utils/conversions.util.js
    at ScopeTracker.addReference (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/scope-tracker.js:47:34)
    at ReferencedIdentifier (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/index.js:202:26)
    at newFn (/home/xyz/Development/metamask-extension/node_modules/@babel/traverse/lib/visitors.js:218:17)
    at bfsTraverse (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/bfs-traverse.js:38:43)
    at Mangler.collect (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/index.js:235:7)
    at Mangler.run (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/index.js:60:12)
    at PluginPass.exit (/home/xyz/Development/metamask-extension/node_modules/babel-plugin-minify-mangle-names/lib/index.js:546:19)
    at newFn (/home/xyz/Development/metamask-extension/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/home/xyz/Development/metamask-extension/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/home/xyz/Development/metamask-extension/node_modules/@babel/traverse/lib/path/context.js:40:17)

Configuration

module.exports = function (api) {
  api.cache(false);
  return {
    parserOpts: {
      strictMode: true,
    },
    presets: [
      '@babel/preset-typescript',
      [
        '@babel/preset-env',
        {
          targets: {
            browsers: ['chrome >= 66', 'firefox >= 68'],
          },
        },
      ],
      '@babel/preset-react',
      'babel-preset-minify',
    ],
    plugins: [
      '@babel/plugin-transform-runtime',
      '@babel/plugin-proposal-class-properties',
      '@babel/plugin-proposal-object-rest-spread',
      '@babel/plugin-proposal-optional-chaining',
      '@babel/plugin-proposal-nullish-coalescing-operator'
    ],
  };
};
@ochodek
Copy link

ochodek commented Mar 10, 2023

There is already a pull request fixing this: #1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants