yaml-loader
Advanced tools
Comparing version 0.4.0 to 0.5.0
10
index.js
@@ -5,4 +5,10 @@ var yaml = require('js-yaml'); | ||
this.cacheable && this.cacheable(); | ||
var res = yaml.safeLoad(source); | ||
return JSON.stringify(res, undefined, '\t'); | ||
try { | ||
var res = yaml.safeLoad(source); | ||
return JSON.stringify(res, undefined, '\t'); | ||
} | ||
catch (err) { | ||
this.emitError(err); | ||
return null; | ||
} | ||
}; |
{ | ||
"name": "yaml-loader", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "YAML loader for webpack (converts YAML to JSON)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,3 @@ # yaml-loader for webpack | ||
``` javascript | ||
var json = require("json!yaml!./file.yml"); | ||
var json = require("json-loader!yaml-loader!./file.yml"); | ||
// => returns file.yml as javascript object | ||
@@ -39,3 +39,3 @@ ``` | ||
```js | ||
// applicatin.js | ||
// application.js | ||
const actualFilename = require(`file?name=[name].json!./../data/${file}.yaml`); | ||
@@ -42,0 +42,0 @@ window.fetch(actualFilename).then(res => { |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3423
12
0