Gathering detailed insights and metrics for webpack-inject-chunk-filename-plugin
Gathering detailed insights and metrics for webpack-inject-chunk-filename-plugin
Gathering detailed insights and metrics for webpack-inject-chunk-filename-plugin
Gathering detailed insights and metrics for webpack-inject-chunk-filename-plugin
Webpack Plugin that injects chunks filename to outputs or any files you define.
npm install webpack-inject-chunk-filename-plugin
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
41 Commits
1 Watchers
9 Branches
1 Contributors
Updated on Apr 17, 2021
Latest Version
1.0.12
Package Id
webpack-inject-chunk-filename-plugin@1.0.12
Unpacked Size
8.00 kB
Size
2.72 kB
File Count
4
NPM Version
6.13.4
Node Version
12.16.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
4
Webpack Plugin that injects chunks filename to outputs or any files you define.
npm i webpack-inject-chunk-filename-plugin -D
Inject chunk's filename to outputs. you should make sure each chunks have name, so that the plugin can find it.
Suppose you have two chunks, app
and lib
. You want to inject chunk lib
's output filename to chunk app
's output source.
First, add a placeholder such as inject-tag-lib
in chunk app
's source file
1import lib from './lib' 2console.log('inject-tag-lib')
Second, configure plugin
1const InjectChunkFilenamePlugin = require('webpack-inject-chunk-filename-plugin') 2 3module.exports = { 4 context: __dirname, 5 entry: { 6 app: './example.js' // make sure your chunk have name 7 }, 8 output: { 9 libraryTarget: 'umd', 10 path: dist, 11 filename: 'bundle.js' 12 }, 13 plugins: [ 14 new InjectChunkFilenamePlugin([ // configure plugin here 15 { 16 targetChunk: 'app', 17 rules: [ 18 { 19 regex: /inject-tag-lib/, 20 injectChunk: 'lib' 21 } 22 ] 23 } 24 ]) 25 ], 26 optimization: { // your split chunks 27 splitChunks: { 28 chunks: 'all', 29 minSize: 0, 30 cacheGroups: { 31 lib: { 32 name: 'lib', // make sure your chunk have name 33 test: /lib/, 34 filename: 'lib.[hash:8].js' 35 } 36 } 37 } 38 } 39}
Last, build and see what you got
In chunk app
's output source, inject-tag-lib
will be replaced will lib.51be9832.js
1... 2console.log('lib.51be9832.js') 3...
Using targetTemplate
in your config, targetTemplate.entry
is your template file's absolute path and targetTemplate.filename
is the output filename.
1const InjectChunkFilenamePlugin = require('webpack-inject-chunk-filename-plugin') 2 3 4module.exports = { 5 context: __dirname, 6 entry: { 7 app: './example.js' 8 }, 9 output: { 10 libraryTarget: 'umd', 11 path: dist, 12 filename: 'bundle.[hash:8].js' 13 }, 14 plugins: [ 15 new InjectChunkFilenamePlugin([ 16 { 17 targetTemplate: { 18 entry: resolve('./template.js'), 19 filename: 'template.[hash:8].js' 20 }, 21 rules: [ 22 { 23 regex: /inject-tag-lib1/, 24 injectChunk: 'lib1' 25 }, 26 { 27 regex: /inject-tag-lib2/, 28 injectChunk: 'lib2' 29 } 30 ] 31 } 32 ]) 33 ], 34 optimization: { 35 splitChunks: { 36 chunks: 'all', 37 minSize: 0, 38 cacheGroups: { 39 lib1: { 40 name: 'lib1', 41 test: /lib1/, 42 filename: 'lib1.[hash:8].js' 43 }, 44 lib2: { 45 name: 'lib2', 46 test: /lib2/, 47 filename: 'lib2.[hash:8].js' 48 } 49 } 50 } 51 } 52}
Name | Type | Description |
---|---|---|
targetChunk | string | chunk to be injected filename |
targetTemplate.entry | string | template file's absolute path |
targetTemplate.filename | string | template file's output filename |
rules[n].regex | object | regex match chunk placeholder |
rules[n].injectChunk | string | chunk will be injected |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
40 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More