webpack-dynamic-resource
v1.0.0
Published
Webpack plugin to dynamically add a resource to the form graph
Downloads
4
Maintainers
Readme
Webpack Dynamic Resource Plugin
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-devOr 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.
