question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-plugin-redux-saga cannot read property start of undefined

See original GitHub issue

Description of the bug/issue

Hi,

I just updated to version 1.0.0 from 1.0.0-rc-0. Everything is working good until I added the babel-plugin then I’m getting exception: TypeError: Cannot read property 'start' of undefined

here is the stactrace:

TypeError: Cannot read property 'start' of undefined
    at calcLocation (/Users/project/node_modules/babel-plugin-redux-saga/src/index.js:57:26)
    at PluginPass.FunctionExpression (/Users/project/node_modules/babel-plugin-redux-saga/src/index.js:116:26)
    at newFn (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:193:21)
    at NodePath._call (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitMultiple (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:85:17)
    at TraversalContext.visit (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:144:19)
    at Function.traverse.node (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:95:18)
    at TraversalContext.visitQueue (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:118:16)
    at TraversalContext.visitSingle (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:90:19)
    at TraversalContext.visit (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:146:19)
    at Function.traverse.node (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:94:17)
    at NodePath.visit (/Users/project/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:95:18)

Steps to reproduce the bug/issue

for me it was just to add the babel-plugin-redux-saga. removing it just works.

here is my babel file:

module.exports = {
  presets: [
    ['@babel/env', { modules: false }],
    '@babel/react',
  ],
  plugins: [
    'babel-plugin-redux-saga',
    '@babel/syntax-dynamic-import',
    '@babel/plugin-proposal-export-namespace-from',
    'babel-plugin-styled-components',
    'react-hot-loader/babel',
    '@babel/plugin-proposal-class-properties',
    ['transform-imports', {
      ramda: {
        transform: importName => `ramda/es/${importName}`,
        preventFullImport: true,
      },
    }],
  ],
  env: {
    test: {
      presets: [
        ['@babel/env'],
        '@babel/react',
      ],
      plugins: [
        'babel-plugin-styled-components',
      ],
    },
  },
};

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mshustovcommented, Jan 27, 2019
1reaction
royipressburgercommented, Jan 27, 2019

@Andarist Hi again I found the issue, This happens when you have some class function with the async prefix.

To reproduce it just clone this repo. add the babel-plugin-redux-saga Then under app/containers/HomePage/HomePage.js add async to the componentDidMount function, and you will see the error

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot read property 'use' of undefined". after upgrade to ...
I had to update to react-script: 4.0.1 due to an error when wanting to migrate part of my project to typeScript. update customize-cra...
Read more >
When using redux-saga with react-native ... - Stack Overflow
This seems to be an issue due to babel-preset-react-native 2.1.0. Simply downgrade to 2.0.0 and it should work fine:
Read more >
Troubleshooting | Redux-Saga
So staring with redux-saga@v1 , when error bubbles to root saga, the library builds that "saga stack" and passes it as a property...
Read more >
typeerror: cannot read property 'location' of undefined jest
I found that I can mock the React Router hooks like useLocation using the following ... TypeError: Cannot read property 'open' of undefined...
Read more >
babel-plugin-redux-saga - npm
Start using babel-plugin-redux-saga in your project by running `npm i babel-plugin-redux-saga`. There is 1 other project in the npm registry ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found