{"id":22259,"library":"rollup-plugin-tla","title":"rollup-plugin-tla","description":"A Rollup plugin that enables top-level await (TLA) support for IIFE and UMD output formats, which Rollup does not natively support. Version 0.0.2 adds TypeScript declarations and supports Node.js >=14.18. It works by transforming the output to use a dynamic import or wrapper to handle TLA. Differentiators: lightweight, no additional runtime dependencies, and specifically targets IIFE/UMD where Rollup's own TLA handling is absent.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/lisonge/rollup-plugin-tla","tags":["javascript","rollup","rollup-plugin","top level await","iife","umd","typescript"],"install":[{"cmd":"npm install rollup-plugin-tla","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-tla","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-tla","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CJS require will fail.","wrong":"const tla = require('rollup-plugin-tla')","symbol":"default","correct":"import tla from 'rollup-plugin-tla'"},{"note":"Package exposes a default export only, not a named export.","wrong":"import { tla } from 'rollup-plugin-tla'","symbol":"tla","correct":"import tla from 'rollup-plugin-tla'"},{"note":"The package includes TypeScript declarations; the default export is typed as a Rollup plugin.","wrong":"import tla from 'rollup-plugin-tla';\nconst plugin = tla(); // works but no type safety","symbol":"Plugin type (TypeScript)","correct":"import type { Plugin } from 'rollup';\nimport tla from 'rollup-plugin-tla';\nconst plugin: Plugin = tla();"}],"quickstart":{"code":"import tla from 'rollup-plugin-tla';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    format: 'iife',\n    file: 'dist/bundle.js'\n  },\n  plugins: [\n    tla()\n  ]\n};","lang":"typescript","description":"Shows how to add top-level await support for IIFE output format using rollup-plugin-tla."},"warnings":[{"fix":"Ensure output format is 'iife' or 'umd'.","message":"Plugin only works for IIFE and UMD formats; for ESM or CJS, Rollup natively supports TLA and this plugin is unnecessary.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Test the bundle thoroughly with your specific plugin chain.","message":"The plugin transforms the output to use a dynamic import or wrapper; this may cause side effects if not used carefully with other plugins that manipulate the AST.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider alternative approaches or test with Rollup v3+.","message":"Package has not been updated since early 2023; compatibility with newer Rollup versions (>=3) is not guaranteed.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change import { tla } from 'rollup-plugin-tla' to import tla from 'rollup-plugin-tla'.","cause":"Using a named import instead of default import leads to the plugin object being malformed.","error":"Error: [object Object] is not a Rollup plugin"},{"fix":"Use import instead of require.","cause":"Trying to use require() in an ESM-only context – require returns the module object, not the plugin function.","error":"${tla} is not a function"},{"fix":"Set output.format to 'iife' or 'umd'.","cause":"Output format is not IIFE or UMD; Rollup fails natively.","error":"Top-level await is not supported in the configured output format"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}