Gathering detailed insights and metrics for yaml-loader
Gathering detailed insights and metrics for yaml-loader
Gathering detailed insights and metrics for yaml-loader
Gathering detailed insights and metrics for yaml-loader
npm install yaml-loader
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
155,554,908
Last Day
101,082
Last Week
542,197
Last Month
2,294,375
Last Year
25,237,113
MIT License
153 Stars
70 Commits
27 Forks
2 Watchers
3 Branches
10 Contributors
Updated on Mar 12, 2025
Minified
Minified + Gzipped
Latest Version
0.8.1
Package Id
yaml-loader@0.8.1
Unpacked Size
6.43 kB
Size
3.04 kB
File Count
4
NPM Version
10.1.0
Node Version
20.8.0
Published on
Feb 21, 2024
Cumulative downloads
Total Downloads
Last Day
40.5%
101,082
Compared to previous day
Last Week
4.8%
542,197
Compared to previous week
Last Month
-3.1%
2,294,375
Compared to previous month
Last Year
-5.5%
25,237,113
Compared to previous year
3
YAML loader for Webpack. Allows importing YAML files as JS objects. Uses yaml
internally.
1npm install --save-dev yaml-loader
1// webpack.config.js 2module.exports = { 3 module: { 4 rules: [ 5 { 6 test: /\.ya?ml$/, 7 use: 'yaml-loader' 8 } 9 ] 10 } 11}
1# file.yaml 2--- 3config: 4 js: 5 key: test 6hello: world
1// application.js 2import file from './file.yaml' 3 4file.hello === 'world'
In addition to all yaml
options used by its parsing methods,
the loader supports the following additional options:
asJSON
If enabled, the loader output is stringified JSON rather than stringified JavaScript. For Webpack v4, you'll need to set the rule to have type: "json"
. Also useful for chaining with other loaders that expect JSON input.
asStream
If enabled, parses the source file as a stream of YAML documents. With this, the output will always be an array, with entries for each document. If set, namespace
is ignored.
To use this option for only some YAML files, it's probably easiest to use a query parameter and match that using Rule.resourceQuery:
1// webpack.config.js 2module.exports = { 3 module: { 4 rules: [ 5 { 6 test: /\.ya?ml$/, 7 oneOf: [ 8 { 9 resourceQuery: /stream/, 10 options: { asStream: true }, 11 loader: 'yaml-loader' 12 }, 13 { loader: 'yaml-loader' } 14 ] 15 } 16 ] 17 } 18}
Then, importing ./foo.yaml
will expect it to contain only one document, but ./bar.yaml?stream
may contain multiple documents.
namespace
Allows for exposing a sub-tree of the source document:
1import jsCfg from './file.yaml?namespace=config.js' 2 3jsCfg.key === 'test'
The namespace
should be a series of keys, dot separated. Note that any options
object in your webpack.config.js
rule will be superseded by a ?query
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
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
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
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