Skip to content

Cannot read property 'arguments' of undefined #12

Open

Description

@aladdin-add
  • webpack@5.10.0
  • optimize-plugin@1.0.0
  • node: v15.2.0
Build completed in 78.241s


Build completed in 0s

TypeError: /Users/weiran/repo/dian/honor/assets/~containers~a~count~cash-114e7fb5.js: Cannot read property 'arguments' of undefined
    at NodePath._getKey (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:194:25)
    at NodePath.get (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:186:17)
    at NodePath._getPattern (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:226:21)
    at NodePath.get (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/family.js:188:17)
    at visitParam (/Users/weiran/repo/dian/honor/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:5836)
    at PluginPass.VariableDeclarator (/Users/weiran/repo/dian/honor/node_modules/babel-preset-modernize/dist/plugins/transform-destructuring/index.js:1:7332)
    at newFn (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/Users/weiran/repo/dian/honor/node_modules/optimize-plugin/node_modules/@babel/traverse/lib/path/context.js:92:31)
error Command failed with exit code 1.

Activity

  1. leonardofaria commented on Dec 21, 2020

    @leonardofaria

    Happening the same here.

    • webpack@4.44.2
    • optimize-plugin@1.0.0
    • node: v12.16.2

    Was trying to troubleshoot here but not sure where to start.

    I have tried removing the preset extra configs and sourceType but no success.

    module.exports = function (api) { // eslint-disable-line func-names
      api.cache(true);
    
      const presets = [
        ['@babel/preset-env', {
          targets: {
            browsers: ['last 2 versions']
          },
          useBuiltIns: 'usage',
          corejs: '3.0.0'
        }],
        '@babel/react'
      ];
    
      const plugins = [
        '@babel/plugin-syntax-dynamic-import',
        '@babel/plugin-proposal-class-properties',
        '@babel/plugin-proposal-do-expressions',
        '@babel/plugin-proposal-export-default-from',
        '@babel/plugin-transform-runtime'
      ];
    
      return {
        presets,
        plugins,
        sourceType: 'module'
      };
    };
  2. developit commented on Feb 22, 2021

    @developit
    Owner

    Just an update: I have a fix for this in babel-preset-modernize that should be released soon.

    In the meantime, you can disable automatic modernization by passing new OptimizePlugin({ modernize: false }).

  3. added
    bugSomething isn't working
    upstreamBlocked on upstream dependency
    on Feb 2, 2022
  4. cjones26 commented on Jun 15, 2022

    @cjones26

    @developit, do you have a link to the PR with this fix? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstreamBlocked on upstream dependency

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions