JSPM

webpack-inject-entry-plugin

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 956
  • Score
    100M100P100Q109408F
  • License MIT

A webpack plugin to inject code into the bundle.

Package Exports

  • webpack-inject-entry-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-inject-entry-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Webpack Inject Entry Plugin

A webpack plugin to inject code into the bundle

What is this? 🧐

A webpack plugin to inject a filepath into a webpack entry. This can be used to build webpack plugins that inject code into the bundle.

Compatible with both Webpack 4 and 5.

Examples 🚀

Usage in a webpack plugin:

import InjectEntry from "webpack-inject-entry-plugin";

export default class MyPlugin {
  constructor(options) {
    this.options = options;
  }

  apply(compiler) {
    new InjectPlugin({
      entry: "main",
      filepath: "./path/to/my/entry/file.js",
    }).apply(compiler);
  }
}

Usage in webpack.config.js:

const InjectEntry = require("webpack-inject-entry-plugin");

module.exports = {
  plugins: [
    new InjectPlugin({
      entry: "main",
      filepath: "./service-worker.js",
    }),
  ],
};

Installation & Usage 📦

  1. Add this package to your project:
    • yarn add webpack-inject-entry-plugin

API Overview 🛠

Name Description Type
entry The name of the webpack entry. string
path The filepath to the source code to inject. string

Contributing 👫

PR's and issues welcomed! For more guidance check out CONTRIBUTING.md

Licensing 📃

See the project's MIT License.