After trying to use json-loader with no success, I cant load an array of JSON into my react code, using webpack 1.4 and babel, if that makes a difference.
import data from '../data/item-types.json';
Returns an empty object with no errors
import data from 'json-loader!../data/item-types.json';
Gives an error message
ERROR in ./~/json-loader!./src/data/item-types.json
Module build failed: SyntaxError: Unexpected token ; in JSON at position 12
at Object.parse (native)
at Object.module.exports (...\node_modules\json-loader\index.js:7:48)
@ ./src/components/search.js 25:17-63
The JSON is an array, 100% valid when pasted in an online JSON editor. I've also tried :
const data = require('../data/item-types.json');
That gives me an empty object
and
const data = require('json!../data/item-types.json');
Gives me the same error as above
Here's a snippet of the data :
["a","b"]