webpack-dynamic-resource

1.0.0 • Public • Published

Webpack Dynamic Resource Plugin

NPM Version License Build Status

A Webpack plugin to dynamically add a resource to the dependency graph during compilation.
This is useful when working with dynamically generated files that should be tracked by Webpack.

📌 Features

Dynamically adds a resource to Webpack's dependency graph
Prevents missing file errors by checking existence before adding
Supports Webpack 4 and 5
Professional error handling
Lightweight & zero external dependencies

📦 Installation

Install via NPM:

npm install webpack-dynamic-resource --save-dev

Or via Yarn:

yarn add webpack-dynamic-resource --dev

🚀 Usage

Modify your webpack.config.js:

const DynamicResourcePlugin = require("webpack-dynamic-resource");

module.exports = {
  plugins: [
    new DynamicResourcePlugin({
      resourcePath: "./src/generated-file.js", // The file Webpack should track
    }),
  ],
};

This ensures that Webpack recompiles whenever ./src/generated-file.js changes.

⚙️ Options

Option Type Default Description
resourcePath string null Path to the file Webpack should track dynamically.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🧑‍💻 Author

Created by The Another Studios
For inquiries, visit theanotherstudios.com or contact us via GitHub.

⭐ Contributing

Contributions are welcome!
Please open an issue or submit a pull request.

Package Sidebar

Install

npm i webpack-dynamic-resource

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.24 kB

Total Files

6

Last publish

Collaborators

  • vincenzomaritato