{"id":21903,"library":"rollup-globals-regex","title":"rollup-globals-regex","description":"A Rollup plugin utility to define globals using RegExp patterns, reducing boilerplate for Angular, RxJS, and other scoped packages. Versions 0.0.x, no recent releases, single maintainer. Converts simple globals object from explicit mappings to regex-based pattern matching with optional transformers like kebab-to-camelCase. Ships TypeScript definitions. Not actively maintained but stable for basic usage.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/gund/rollup-globals-regex","tags":["javascript","rollup","globals","config","regexp","typescript"],"install":[{"cmd":"npm install rollup-globals-regex","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-globals-regex","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-globals-regex","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-first; CommonJS require may not work depending on bundler configuration.","wrong":"const globalsRegex = require('rollup-globals-regex')","symbol":"globalsRegex","correct":"import { globalsRegex } from 'rollup-globals-regex'"},{"note":"GLOBAL is an object containing predefined regex patterns; property names are uppercase strings.","wrong":null,"symbol":"GLOBAL","correct":"import { GLOBAL } from 'rollup-globals-regex'"},{"note":"TypeScript users should use type import to avoid runtime error if transformers are not exported as values.","wrong":"import { GlobalsRegexTransformer } from 'rollup-globals-regex' (if not used at runtime)","symbol":"GlobalsRegexTransformer","correct":"import type { GlobalsRegexTransformer } from 'rollup-globals-regex'"}],"quickstart":{"code":"import { globalsRegex, GLOBAL } from 'rollup-globals-regex';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife',\n    name: 'MyBundle',\n    globals: globalsRegex({\n      'jquery': '$',\n      'lodash': '_',\n      [GLOBAL.NG2]: GLOBAL.NG2.TPL,\n      [GLOBAL.RX]: GLOBAL.RX.TPL,\n    })\n  },\n  external: ['jquery', 'lodash', '@angular/core', '@angular/common', 'rxjs']\n};","lang":"typescript","description":"Shows how to configure Rollup globals using regex patterns for Angular and RxJS packages."},"warnings":[{"fix":"Migrate to manual globals mapping or use Rollup's built-in globals option with a function.","message":"Package is not actively maintained; last release 6+ years ago. Consider alternatives like @rollup/plugin-commonjs or custom globals functions.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Double-check transformer behavior or define custom regex patterns without transformers.","message":"GLOBAL.NG2.TPL applies kebab-to-camelCase transformer; ensure your Angular package names use kebab-case (e.g., '@angular/platform-browser').","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"// @ts-ignore or (globalsRegex as any)({ ... })","message":"Using computed property keys with GLOBAL symbols may cause TypeScript errors if no index signature is defined; cast to 'any' if needed.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install @types/rollup-globals-regex manually (if available) or declare module 'rollup-globals-regex' { ... } in a .d.ts file.","message":"The package does not export types for GLOBAL properly; TypeScript users may need to declare module augmentations.","severity":"gotcha","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":"npm install rollup-globals-regex --save-dev","cause":"Package not installed or npm install failed.","error":"Cannot find module 'rollup-globals-regex'"},{"fix":"Ensure import is correct: import { GLOBAL } from 'rollup-globals-regex'. If using TS <3.8, use import GLOBAL = require('rollup-globals-regex').GLOBAL","cause":"Using incorrect import path or TypeScript version mismatch.","error":"Module 'rollup-globals-regex' has no exported member 'GLOBAL'"},{"fix":"Use ES module import: import { globalsRegex } from 'rollup-globals-regex' or if using CommonJS, try dynamic import: const { globalsRegex } = await import('rollup-globals-regex')","cause":"CommonJS require used incorrectly; package is ESM only.","error":"TypeError: globalsRegex is not a function"},{"fix":"Add 'type':'module' to your package.json or rename file to .mjs. Alternatively use --experimental-modules flag.","cause":"Node.js ESM requires explicit .mjs extension or package.json 'type':'module'.","error":"The requested module 'rollup-globals-regex' does not provide an export named 'GLOBAL' (in Node ESM)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}