dependency of json loader not installed by default though json loading is supported
See original GitHub issueCan you reproduce the problem with latest npm?
Yes
Description
json file loading is supported as per react scripts but dependency on package json
is not installed by default.
Expected behavior
import defaultData from './mealsdata.json';
should work by default
Actual behavior
Error:
Module not found: 'json' in /home/srinathh/src/bitbucket.org/srinathh/
however, it works after i do npm install --save-dev json
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error when attempting to import JSON into a React component
Error when attempting to import JSON into a React component: "You may need an appropriate loader", but the correct loader is already installed....
Read more >json-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >json — JSON encoder and decoder — Python 3.11.1 ...
The json module always produces str objects, not bytes objects. Therefore, fp.write() must support str input. If ensure_ascii is true (the default), the ......
Read more >How to import JSON files in ES modules (Node.js) - Stefan Judis
This post explains ways to deal with JSON in ES modules if you don't want to use the experimental feature yet. Option 1:...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Modules are loaded multiple times if the import specifier used to resolve them has ... foo.json' assert { type: 'json' }; const {...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmmm… this was on an existing app. Let me try on a clean install of CRA, check and get back.
On Mar 13, 2017 23:29, “Dan Abramov” notifications@github.com wrote:
Hmm, json-loader does not depend on a module called json. Check its source code https://github.com/webpack-contrib/json-loader/blob/master/index.js and package.json https://github.com/webpack-contrib/json-loader/blob/master/package.json.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/facebookincubator/create-react-app/issues/1803#issuecomment-286190975, or mute the thread https://github.com/notifications/unsubscribe-auth/AC1hFVlVGU8_R2MOWCuoYRmBDxMeQ8y0ks5rlYPvgaJpZM4Mai77 .
I believe I have a consistent repro of this here. https://github.com/facebookincubator/create-react-app/issues/1895