{"id":22277,"library":"rollup-plugin-use-client","title":"rollup-plugin-use-client","description":"Rollup plugin (v1.4.0) that re-adds the 'use client' directive stripped by Rollup during bundling, essential for React Server Components. Released December 2022, maintained on GitHub. Key differentiator: solves the specific problem of directive removal in Rollup, with configurable directive string and simple ESM API. Unmaintained since 2022.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/DParfitt/rollup-plugin-use-client","tags":["javascript","rollup","react-server-components","use","client","typescript"],"install":[{"cmd":"npm install rollup-plugin-use-client","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-use-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-use-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; named import will result in undefined.","wrong":"import { useClient } from 'rollup-plugin-use-client'","symbol":"useClient","correct":"import useClient from 'rollup-plugin-use-client'"},{"note":"CommonJS require returns the default export directly.","wrong":"const { useClient } = require('rollup-plugin-use-client')","symbol":"useClient","correct":"const useClient = require('rollup-plugin-use-client')"},{"note":"Namespace import is not the default; use default import.","wrong":"import * as useClient from 'rollup-plugin-use-client'","symbol":"useClient","correct":"import useClient from 'rollup-plugin-use-client'"}],"quickstart":{"code":"// Install: npm install --save-dev rollup-plugin-use-client\nimport useClient from 'rollup-plugin-use-client';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    useClient()\n  ]\n};","lang":"typescript","description":"Shows basic setup to add 'use client' directive in Rollup config."},"warnings":[{"fix":"Ensure code splitting is enabled or only apply plugin to specific files via include/exclude options.","message":"Plugin adds 'use client' to top of every file processed; in single-bundle output, the directive may be added to the entire bundle, causing unintended behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use compatible bundler or check target runtime support.","message":"The directive is inserted as a string literal at the top of the module; if used with plugins that expect the directive to be a comment or statement, it may not be recognized correctly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to: import useClient from 'rollup-plugin-use-client'","cause":"Imported useClient as a named export instead of default.","error":"TypeError: useClient is not a function"},{"fix":"Ensure plugin is added to plugins array: plugins: [useClient()]","cause":"Plugin not included in Rollup plugins array or output file not covered.","error":"'use client' directive not added to output"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}