Error when trying to require a JSON file
xavimb opened this issue · comments
Webpack version: 0.12.2
I'm getting this error:
ERROR in dir/~/json-loader!dir/embedded/config.json
Module build failed: SyntaxError: Unexpected token m
at Object.parse (native)
at Object.module.exports (dir/node_modules/json-loader/index.js:7:48)
@ dir/embedded/includers/index.js 12:21-51
and in the includers/index.js
I have this line:
var embeddedConfig = require("json!../config.json");
After checking, the problem is that the json-loader gets called two times, and the first one returns the expected outcome: "module.exports = {....}"
but the second time it has "module.exports = {....}"
as a source, so it tries to parse the string to JSON and then it fails because it's not a valid JSON.
Is anyone else getting the same error or did I do something wrong in the configuration?
I am also getting the same error
Same error here :(
Still having the error in latest json loader