Last active
January 1, 2017 07:40
-
-
Save willybeans/720da5ebdb894559aaf3495aad47ac2e to your computer and use it in GitHub Desktop.
Error in 4. Working with test data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When i try to "npm run dev" with the JSON test data file im receiving this error: | |
ERROR in ./src/testData.json | |
Module build failed: SyntaxError: Unexpected token | |
in JSON at position 262 | |
at Object.parse (native) | |
at Object.module.exports (/Users/williamwedmedyk/jsPrac/jscomplete/node_modules/json-loader/index.js:11:48) | |
@ ./src/index.js 11:16-37 | |
here is my index.js file: | |
5 module.exports = function(source) { | |
6 | |
7 if (typeof source === "string" && source.indexOf("module.exports = ") === 0) { | |
8 return source; | |
9 } | |
10 this.cacheable && this.cacheable(); | |
11 var value = typeof source === "string" ? JSON.parse(source) : source; | |
12 this.value = [value]; 13 return "module.exports = " + JSON.stringify(value, undefined, "\t") + ";"; | |
14 } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"contests": [ | |
{ | |
"id": 1, | |
"categoryName": "Business-Company", | |
"contestName": "Cognitive Building Bricks" | |
}, | |
{ | |
"id": 2, | |
"categoryName": "Magazine-Newsletter", | |
"contestName": "Educating people about sustainable food | |
production" | |
}, | |
{ | |
"id": 3, | |
"categoryName": "Software Company", | |
"contestName": "Big Data Analytics for cash ciculation" | |
}, | |
{ | |
"id": 4, | |
"categoryName": "Website", | |
"contestName": "Free programming books" | |
}, | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment