Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/privatenumber/code-inject-loader
Inject code to certain files
https://github.com/privatenumber/code-inject-loader
append code inject loader prepend transform webpack
Last synced: 18 days ago
JSON representation
Inject code to certain files
- Host: GitHub
- URL: https://github.com/privatenumber/code-inject-loader
- Owner: privatenumber
- License: mit
- Created: 2019-04-12T01:42:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T04:05:31.000Z (about 4 years ago)
- Last Synced: 2024-10-12T00:44:55.509Z (25 days ago)
- Topics: append, code, inject, loader, prepend, transform, webpack
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# code-inject-loader
> Inject code to certain files## How to use
Add as a loader rule to configure which files the loader should inject code into.webpack.config.js
```
moule.exports = {
...,module: {
rules: [
{
test: /src/,
loader: 'code-inject-loader',
options: {
prepend: `console.log('Hello Im in every file');`
},
},
...
]
},...
}
```### Options
- *prepend * Add code to the beginning of the file
- *append * Add code to the bottom of the file
- *transform(source) * Function to make changes to the source code of the file