{"id":21959,"library":"rollup-plugin-concurrent-top-level-await","title":"rollup-plugin-concurrent-top-level-await","description":"Rollup and Vite plugin (v0.4.1) that restores concurrent execution of modules with top-level await (TLA), which Rollup/Vite otherwise serialize. Provides near-perfect evaluation order matching V8 (99%+ on tla-fuzzer) by transforming both TLA-containing modules and their ancestor modules up to the lowest common ancestor. Ships TypeScript types, supports include/exclude filters, source maps, and configurable variable prefix. Requires Rollup ^4.0.0 or Vite >=5.0.0 <8.0.0. Not compatible with Rolldown or Vite >=8. Does not polyfill TLA—runtime support needed.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":"https://github.com/zOadT/concurrent-top-level-await-plugins","tags":["javascript","rollup-plugin","vite-plugin","top-level-await","tla","concurrent","async","modules","es2022","typescript"],"install":[{"cmd":"npm install rollup-plugin-concurrent-top-level-await","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-concurrent-top-level-await","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-concurrent-top-level-await","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Rollup plugin API (^4.0.0 required)","package":"rollup","optional":false},{"reason":"Peer dependency for Vite compatibility (>=5.0.0 <8.0.0)","package":"vite","optional":true}],"imports":[{"note":"Default export is a function; named export does not exist. CJS require() returns the default export as module.exports.","wrong":"const { concurrentTopLevelAwait } = require('rollup-plugin-concurrent-top-level-await')","symbol":"default","correct":"import concurrentTopLevelAwait from 'rollup-plugin-concurrent-top-level-await'"},{"note":"In CommonJS, the plugin is the default export directly; no .default needed.","wrong":"const { default: concurrentTopLevelAwait } = require('rollup-plugin-concurrent-top-level-await')","symbol":"default (CJS)","correct":"const concurrentTopLevelAwait = require('rollup-plugin-concurrent-top-level-await')"},{"note":"The package does not export a Plugin type; use Rollup's or Vite's own type.","wrong":"import { Plugin } from 'rollup-plugin-concurrent-top-level-await'","symbol":"Plugin type (TypeScript only)","correct":"import type { Plugin } from 'rollup'"},{"note":"Available from v0.4.0+. Not needed for JavaScript users.","wrong":"","symbol":"Options type","correct":"import type { ConcurrentTopLevelAwaitOptions } from 'rollup-plugin-concurrent-top-level-await'"}],"quickstart":{"code":"// rollup.config.js\nimport concurrentTopLevelAwait from 'rollup-plugin-concurrent-top-level-await';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    concurrentTopLevelAwait({\n      include: '**/*.js',\n      exclude: 'node_modules/**',\n      sourceMap: true,\n      generatedVariablePrefix: '__tla'\n    })\n  ]\n};\n\n// Install: npm install --save-dev rollup rollup-plugin-concurrent-top-level-await","lang":"typescript","description":"Basic Rollup config using the plugin with include/exclude filters, source maps, and custom variable prefix."},"warnings":[{"fix":"Use rolldown-plugin-concurrent-top-level-await for Rolldown; stay on Vite <8.0.0 or wait for updated version.","message":"Plugin is incompatible with Rolldown and Vite >= 8.0.0 due to use of Rollup-specific APIs.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use include patterns that cover all modules on the import path from entry to TLA modules (see README section).","message":"Ancestor modules of TLA modules must also be included in the plugin's transform scope, or evaluation order may differ.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If targeting older environments, use vite-plugin-top-level-await to polyfill TLA.","message":"The plugin does not polyfill top-level await; runtime support (e.g., modern browser, Node 22+) is required.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"No action needed; this option is ignored by the plugin.","message":"The `experimental.nativeMagicString` option in Rolldown is no longer required but also not used here; may confuse users migrating.","severity":"deprecated","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev rollup-plugin-concurrent-top-level-await`","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'rollup-plugin-concurrent-top-level-await'"},{"fix":"Change to `import concurrentTopLevelAwait from 'rollup-plugin-concurrent-top-level-await'`","cause":"Using named import `{ concurrentTopLevelAwait }` instead of default import.","error":"TypeError: concurrentTopLevelAwait is not a function"},{"fix":"Downgrade Vite to 7.x or use rolldown-plugin-concurrent-top-level-await instead.","cause":"Vite version >=8.0.0 is not supported (plugin requires <8.0.0).","error":"Error: This plugin is not compatible with version 8.x of Vite. Check peer dependencies."},{"fix":"Ensure `include` covers all ancestor modules and that source maps are enabled (`sourceMap: true`).","cause":"Source map generation failed for a transformed file, often due to incorrect include/exclude patterns.","error":"Error: (plugin concurrent-top-level-await) Could not resolve source map"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}