Closed CptAsgard closed 8 years ago
If you are trying to load a json file, you need to modify your webpack loader to have a json loader.
https://github.com/webpack/json-loader
via
npm install --save-dev json-loader
Then try adding this line to your webpack.config.js
{
module: {
loaders: [
{ test: /\.json$/, loader: "json-loader" }
],
}
}
It appears that a module depends on the package.json
file which is a weird practice, but this should solve your problem.
Alright, fair enough. I did install json-loader, but I didn't add it to the webpack config. It works now, thank you very much!
Neat! Glad I could help.
Good luck with your project!
I got this error too when using P2.js thorugh NPM in a webpack project. It helped to add the json-loader (Remember to add it to your webpack config)
After downloading p2 through npm like so:
npm i p2 -D
I get the following error when trying to build my project
I haven't been able to trace this to any source. I've validated the json syntax of package.json, and I've checked if it's a valid package.json file, which it both is. I have also installed the json-loaader.
Any idea?