Version 1.0.2
@stackline/rollup-plugin-inject
Scan modules for global variables and injects `import` statements where necessary
Independent maintenance of @rollup/plugin-inject 5.0.5. Original authors and licenses are retained.
Installation
# Preserve existing imports with an npm alias
npm install @rollup/plugin-inject@npm:@stackline/rollup-plugin-inject@1.0.2
# Or use the scoped package name in your imports
npm install @stackline/rollup-plugin-inject@1.0.2Node.js: >=14.0.0. Read the compatibility and maintenance notes before migrating.
Usage and API
@stackline/rollup-plugin-inject
Scan modules for global variables and injects
importstatements where necessary.
Documentation | npm | Issues | Repository
Current package version: 1.0.2
Why this package?
@stackline/rollup-plugin-inject is the Stackline-maintained distribution of @rollup/plugin-inject@5.0.5. It is an independent continuation of @rollup/plugin-inject; original authors and licenses remain credited below.
Compatibility
| Item | Value |
|---|---|
| Package | @stackline/rollup-plugin-inject@1.0.2 |
| API target | @rollup/plugin-inject@5.0.5 |
| Supported Node.js | >=14.0.0 |
| License | MIT |
| Main entry | ./dist/cjs/index.js |
| Module entry | ./dist/es/index.js |
| Types | ./types/index.d.ts |
| Runtime dependencies | @rollup/pluginutils, estree-walker, magic-string |
| Peer dependencies | rollup ^1.20.0||^2.0.0||^3.0.0||^4.0.0 |
Installation
npm install @stackline/rollup-plugin-inject
Preserve existing imports and plugin resolution with an npm alias:
npm install @rollup/plugin-inject@npm:@stackline/rollup-plugin-inject
Usage and API reference
Rollup Plugins
🍣 The one-stop shop for official Rollup plugins
This repository houses plugins that Rollup considers critical to every day use of Rollup, plugins which the organization has adopted maintenance of, and plugins that the project recommends to its users.
Plugins Found Here
| alias | Define and resolve aliases for bundle dependencies |
| auto-install | Automatically install dependencies that are imported by a bundle |
| babel | Compile your files with Babel |
| beep | System beeps on errors and warnings |
| buble | Compile ES2015 with buble |
| commonjs | Convert CommonJS modules to ES6 |
| data-uri | Import modules from Data URIs |
| dsv | Convert .csv and .tsv files into JavaScript modules with d3-dsv |
| dynamic-import-vars | Resolving dynamic imports that contain variables. |
| eslint | Verify entry point and all imported files with ESLint |
| esm-shim | Replace cjs syntax for esm output bundles |
| graphql | Convert .gql/.graphql files to ES6 modules |
| html | Create HTML files to serve Rollup bundles |
| image | Import JPG, PNG, GIF, SVG, and WebP files |
| inject | Scan modules for global variables and injects import statements where necessary |
| json | Convert .json files to ES6 modules |
| legacy | Add export declarations to legacy non-module scripts |
| multi-entry | Use multiple entry points for a bundle |
| node-resolve | Locate and bundle third-party dependencies in node_modules |
| replace | Replace strings in files while bundling |
| run | Run your bundles in Node once they're built |
| strip | Remove debugger statements and functions like assert.equal and console.log from your code |
| sucrase | Compile TypeScript, Flow, JSX, etc with Sucrase |
| swc | Transpile TypeScript/JavaScript with the speedy-web-compiler |
| terser | Generate a minified output bundle with terser |
| typescript | Integration between Rollup and Typescript |
| url | Import files as data-URIs or ES Modules |
| virtual | Load virtual modules from memory |
| wasm | Import WebAssembly code with Rollup |
| yaml | Convert YAML files to ES6 modules |
Other Packages Found Here
| pluginutils | A set of utility functions commonly used by Rollup plugins |
Contributing
This repository is a monorepo which leverages pnpm for dependency management.
To begin, please install pnpm:
$ npm install pnpm -g
Working with Plugin Packages
All plugin packages are kept in the /packages directory.
Adding dependencies:
$ pnpm --filter ./packages/<name> add <package>
Where <package> is the name of the NPM package you wish to add for a plugin package, and <name> is the proper name of the plugin. e.g. @rollup/plugin-beep.
Publishing:
$ pnpm publish <name> [flags]
Where <name> is the portion of the plugin package name following @rollup/plugin-. (e.g. beep)
The publish script performs the following actions:
- Gathers commits from the last release tag
- Determines the next appropriate version bump (major, minor, or patch)
- Updates
package.json - Generates a new ChangeLog entry
- Updates
CHANGELOG.mdfor the target plugin - Commits
package.jsonandCHANGELOG.md, with a commit message is in the formchore(release): <name>-v<version> - Publishes to NPM
- Tags the release in the form
<name>-v<version>(e.g.beep-v0.1.0) - Pushes the commit and tag to Github
Flags
The following flags are available to modify the publish process:
--drytells the script to perform a dry-run, skipping any file modifications, NPM, or Git Actions. Results from version determination and new ChangeLog additions are displayed.--major,--minor,--patchcan be used to force a particular type of semver bump.--no-pushwill instruct the script not to push changes and tags to Git.--no-tagwill instruct the script not to tag the release.
Running Tests:
To run tests on all packages which have changes:
$ pnpm test
To run tests on a specific package:
$ pnpm --filter ./packages/<name> test
Linting:
To lint all packages which have changes:
$ pnpm lint
To lint a specific package:
$ pnpm --filter ./packages/<name> lint
Note: Scripts in the repository will run the root test and lint script on those packages which have changes. This is also how the CI pipelines function. To run either on a package outside of that pipeline, use pnpm <script> @rollup/plugin-<name>.
Adding Plugins
While we don't have an official procedure for adding third-party plugins to this repository, we are absolutely open to the idea. If you'd like to speak about your project being a part of this repo, please reach out to @RollupJS on Twitter.
Meta
Credits and original authors
- Original project: @rollup/plugin-inject.
- Rich Harris.
- Stackline maintenance: Alexandro Paixao Marques and Stackline contributors.
Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.
License
MIT. See the license and notice files in the repository.
Community and Links
Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.
Upstream issues and maintenance review
Upstream origin and triage
- Original package:
@rollup/plugin-inject@5.0.5 - Repository: https://github.com/rollup/plugins
- Source commit: https://github.com/rollup/plugins/commit/d55ce9c6d76a008b0d0bcec86b310e1e51636384
- Source directory:
packages/inject - npm tarball: https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz
- SHA512 integrity:
sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg== - npm last-release age selects maintenance scope; it does not imply no ongoing source development.
Reviewed issues
Primary-source snapshot: 2026-09-29T00:22:07.903653+00:00. Most recently updated 100 open and 30 closed issue/PR entries; PRs removed. This is triage evidence, not a claim of exhaustive review.
Maintenance adoption with preserved runtime payload. No runtime defect correction is claimed. Reports remain visible for subsequent targeted reproduction.
- 2024: @rollup/plugin-virtual: TS2349: This expression is not callable under modern "moduleResolution": "NodeNext"
- 1860:
typesare wrong configed - 2023: Typescript and noEmitOnError regressions/issues
- 2022: typescript
6.0.3dependency issue - 2016:
@rollup/plugin-typescript- Support for TypeScript 7 - 2015: Support js-yaml v5
- 1874: [node-resolve] Replace
resolveand some rollup-bakedexportsfields handling with a Rust-based resolver - 2014: Babel 8 support
- 2011: replace: Should property accessors be replaced or not?
- 2008:
@rollup/plugin-typescriptshould error on TypeScript import of missing.jsonfile (bundled with a different name by@rollup/plugin-json) - 2005: @rollup/plugin-babel causes SOURCEMAP_ERROR while reporting THIS_IS_UNDEFINED from unmapped generated helper code
- 1885: [@rollup/plugin-commonjs] Bring back named exports in commonjs entry points
- 1992: import YAML file, RollupError: 'Legacy octal escape is not permitted in strict mode'
- 1948: [@rollup/plugin-typescript]: Source-map source paths break if "sourceRoot" is specified
- 1970: plugin-terser does not share nameCache between minify invocations when chunking across multiple entrypoint and common files
- 1973: Minification removes class identifiers causing observable runtime change in Class.name
- 1966: Incorrect sourcemap sources paths when outDir differs from source directory
- 1935: charlie: ESM update of auto-install
- 1918: @rollup/plugin-url does not use the asset mechanism
- 1946: node-resolve plugin discards this re-exported file
- 1941: Allow typescript transpilation not to match rollup file option
- 1672: [@rollup/plugin-commonjs] engine-v8-version.js:25 Uncaught TypeError: userAgent.match is not a function at engine-v8-version.js:25:21 in core-js
- 986: commonjs - Missing export (Error: ... is not exported by ...)
- 1873: [node-resolve]: the external module render path is not expected
- 1739: Wasm plugin to support latest ESM Integration & Source Phase Imports
- 1858:
@rollup/plugin-typescriptseems not recognizing.d.[ext].tsstyle definition files? - 1851: Typescript conflict in Deno
- 539: Proposal: Add support for full ES-Node interop
- 3: Core-Critical Plugin Script
The structured snapshot in .stackline/issue-triage.json also records recently closed reports. Issues for unrelated packages in shared monorepositories were qualified as outside this fork’s runtime scope. No maintainer was contacted.
Release files and references
Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.