{"id":24963,"library":"babel-plugin-transform-object-spread-inline","title":"babel-plugin-transform-object-spread-inline","description":"A Babel plugin that transpiles object spread syntax into inline assignments and for loops using Object.keys, avoiding the slower for...in with hasOwnProperty check. Version 0.0.3 appears to be the latest, with no recent updates. It provides a performance alternative to the default babel-plugin-transform-object-rest-spread by generating faster code for object spreads, especially when only one spread is used. Note that it does not handle object rest syntax and may not be suitable for multiple spreads per object.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/finom/babel-plugin-transform-object-spread-inline","tags":["javascript","babel-plugin","syntax","spread"],"install":[{"cmd":"npm install babel-plugin-transform-object-spread-inline","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-object-spread-inline","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-object-spread-inline","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is a Babel plugin, not imported in source code. It's configured in .babelrc or babel.config.js.","wrong":"require('babel-plugin-transform-object-spread-inline')","symbol":"default","correct":"// Add to .babelrc plugins array:\n\"transform-object-spread-inline\""},{"note":"Must be saved as a devDependency, not a regular dependency.","wrong":"npm install babel-plugin-transform-object-spread-inline","symbol":"default (from npm)","correct":"npm install --save-dev babel-plugin-transform-object-spread-inline"}],"quickstart":{"code":"// Install plugin\nnpm install --save-dev babel-plugin-transform-object-spread-inline\n\n// .babelrc configuration\n{\n  \"plugins\": [\"transform-object-spread-inline\"]\n}\n\n// Input source\nconst a = { b, c, ...d, e, f: 42 };\n\n// Output (compiled)\n\"use strict\";\nvar _keys, _l, _i, _source, _key, _result = {};\n_result.b = b;\n_result.c = c;\nfor (_source = d, _keys = Object.keys(_source), _l = _keys.length, _i = 0; _i < _l; _i++) {\n  _key = _keys[_i];\n  _result[_key] = _source[_key];\n}\n_result.e = e;\n_result.f = 42;\na = _result;","lang":"javascript","description":"Shows installation, configuration, and transformation of object spread into faster inline code using Object.keys."},"warnings":[{"fix":"Use a separate plugin like @babel/plugin-proposal-object-rest-spread for rest syntax.","message":"This plugin does not transpile object rest syntax (e.g., const { a, ...rest } = obj).","severity":"gotcha","affected_versions":"all"},{"fix":"Minimize the number of spreads per object, or avoid this plugin if many spreads are used.","message":"Using multiple spread operators in a single object literal will generate multiple loops, potentially negating performance benefits.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using @babel/plugin-proposal-object-rest-spread with built-in optimization or use modern Babel presets.","message":"The plugin has not been updated recently and may not be compatible with newer Babel versions (e.g., Babel 7+).","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"If you need inherited properties, do not use this plugin and stick with the standard plugin.","message":"The plugin's transformation uses Object.keys, which does not include inherited enumerable properties, unlike for...in.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install --save-dev babel-plugin-transform-object-spread-inline","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'babel-plugin-transform-object-spread-inline'"},{"fix":"Ensure the plugin is in .babelrc 'plugins' array and check for rest patterns; use separate plugin for rest.","cause":"Babel is not configured to use the plugin, or the source contains rest syntax not spread.","error":"SyntaxError: Unexpected token ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}