{"id":19143,"library":"babel-plugin-redux-saga","title":"babel-plugin-redux-saga","description":"Babel plugin (v1.2.0, latest) that enhances redux-saga error messages by adding file location metadata to generator functions and effects. During transpilation, it attaches '@@redux-saga/LOCATION' properties to sagas and call/yield expressions, enabling developer tools to display source file, line number, and code snippet in error traces. Key differentiator: zero runtime overhead since it's a compile-time transform. Still in beta (not recommended for production). Works with Babel 6/7 and redux-saga ^1.0.0-rc.0. Does not support React Native. Inactive development since 2020.","status":"maintenance","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/redux-saga/redux-saga#main","tags":["javascript","babel-plugin","redux-saga"],"install":[{"cmd":"npm install babel-plugin-redux-saga","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-redux-saga","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-redux-saga","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The plugin instruments redux-saga code fragments with meta-data, requiring redux-saga at runtime (peer dependency).","package":"redux-saga","optional":false}],"imports":[{"note":"Babel plugin must be specified as a string in the plugins array. Node-style require is not valid for Babel config.","wrong":"// CommonJS require in plugin list (not supported)\nconst plugin = require('babel-plugin-redux-saga');\nplugins: [plugin]","symbol":"babel-plugin-redux-saga","correct":"// in .babelrc or babel.config.js\nplugins: ['babel-plugin-redux-saga']"},{"note":"When passing options, wrap the plugin name and options in an array. The wrong syntax places the plugin name and options as separate entries in the plugins array.","wrong":"{\n  \"plugins\": [\"babel-plugin-redux-saga\", { \"useAbsolutePath\": true }]\n}","symbol":"useAbsolutePath option","correct":"// .babelrc\n{\n  \"plugins\": [\n    [\"babel-plugin-redux-saga\", { \"useAbsolutePath\": true }]\n  ]\n}"}],"quickstart":{"code":"// 1. Install\n// npm i --save-dev babel-plugin-redux-saga\n\n// 2. Babel config (e.g., .babelrc)\n{\n  \"plugins\": [\"babel-plugin-redux-saga\"]\n}\n\n// 3. Example saga (source)\nfunction* mySaga() {\n  const data = yield call(api.fetch, '/users');\n}\n\n// 4. After transformation, error messages include file/line:\n// \"The above error occurred in task mySaga  src/sagas.js?12\"\n// \"call(api.fetch, '/users')  src/sagas.js?13\"","lang":"javascript","description":"Shows installation, Babel plugin configuration, and the resulting enhanced error trace with file locations."},"warnings":[{"fix":"Migrate to redux-saga's native error handling or use source maps instead.","message":"Package is no longer actively maintained; last release was in 2020. Consider alternatives like @redux-saga/debug or redux-saga's built-in error handling.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Avoid using in production builds. Consider testing thoroughly before deploying.","message":"Plugin is still in beta; use on your own risk. Not recommended for production environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Do not use this plugin in React Native projects. Use alternative debugging tools.","message":"Plugin does not work with React Native due to unsupported Babel transforms in that environment.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Enable source maps in your build tool (e.g., webpack devtool) to maintain debuggable output.","message":"The plugin modifies source code by adding 'Object.defineProperty' calls, which may affect code readability in transpiled output. Use source maps for debugging.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install --save-dev babel-plugin-redux-saga","cause":"The package is not installed as a devDependency, or Babel is not configured to look in node_modules.","error":"Module not found: Can't resolve 'babel-plugin-redux-saga'"},{"fix":"Ensure the plugin name is exactly 'babel-plugin-redux-saga' in the plugins array.","cause":"The plugin is missing in your Babel configuration path.","error":"Error: Cannot find module 'babel-plugin-redux-saga'"},{"fix":"Do not use this plugin in React Native projects. Remove it from your Babel config when building for React Native.","cause":"React Native's Babel transform pipeline does not support the plugin's AST modifications.","error":"The plugin does not work with React Native"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}