Gathering detailed insights and metrics for text-replace-file-loader
Gathering detailed insights and metrics for text-replace-file-loader
Gathering detailed insights and metrics for text-replace-file-loader
Gathering detailed insights and metrics for text-replace-file-loader
npm install text-replace-file-loader
Typescript
Module System
Node Version
NPM Version
68.5
Supply Chain
94.7
Quality
74.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
906
Last Day
2
Last Week
3
Last Month
14
Last Year
94
MIT License
14 Commits
1 Watchers
2 Branches
1 Contributors
Updated on May 01, 2018
Latest Version
0.1.0
Package Id
text-replace-file-loader@0.1.0
Size
4.25 kB
NPM Version
4.2.0
Node Version
7.10.1
Cumulative downloads
Total Downloads
Last Day
0%
2
Compared to previous day
Last Week
50%
3
Compared to previous week
Last Month
27.3%
14
Compared to previous month
Last Year
10.6%
94
Compared to previous year
2
A loader for webpack that imports all files in a given document, replacing the 'require' statements with their public path.
1npm install --save-dev text-replace-file-loader
Use the loader either via your webpack config, CLI or inline.
webpack.config.js
1module.exports = { 2 module: { 3 rules: [ 4 { 5 test: /\.json$/, 6 use: ['json-loader', 'text-replace-file-loader?name=[name].[ext]'] 7 } 8 ] 9 } 10}
webpack.config.js
1module.exports = { 2 output: { 3 path: path.resolve(__dirname, 'dist'), 4 filename: 'something.js', 5 publicPath: '/', 6 }, 7 module: { 8 loaders: [ 9 { 10 test: /\.json$/, 11 // This will output both the json and all files the json requires on. 12 use: ['file-loader?name=[name].[ext]', 'text-replace-file-loader?name=[name].[ext]'] 13 } 14 ] 15 } 16}
In your application
1const myJson = require('./file.json'); // Can handle any type of file though.
Your Json: file.json
1{ 2 "key1": { 3 "key2": { 4 "key3": "require('assets/images/image1.png')" 5 }, 6 "key4": "require('assets/index.json')" 7 } 8}
Directory listing
1something.js 2image1.png 3index.json 4file.json
Output Json: dist/file.json
1{ 2 "key1": { 3 "key2": { 4 "key3": "/image1.png" 5 }, 6 "key4": "/index.json" 7 } 8}
Note: If publicPath were 'myurl' then it would be 'myurl/image1.png' rather than '/image1.png'
This module has two different options:
require('.*')
statements are encountered. It can be one of three values. The default is 'emit'.
Note that for file-emitting operations, this module clones its context and passes it on to file-loader
. Because of this, please reference file-loader
's
main page for information on
options and config for emitting files. You can pass these options to this loader when emitting files.
http://scottcrossen42.com
scottcrossen42@gmail.com
Brady Parks, Sydney MacFarlane, John Hancock, Doug Patterson, Megan Parks, Madison Russell
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 0/13 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 effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
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