Loading json files with webpack plugin
See original GitHub issueI am using the webpack plugin and I am not sure what’s the right way to load json files.
I’ve added the json-loader
plugin: https://github.com/RalucaNicola/edge-rendering/blob/master/webpack.config.js#L36 but I get the following error:
Error: Cannot find module '/Library/WebServer/Documents/edge-rendering/node_modules/json-loader/index.js!/Library/WebServer/Documents/edge-rendering/node_modules/dojo/package.json'
Should I add something else to the webpack config or should I load it differently?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
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 >Load static JSON file in Webpack - Stack Overflow
Webpack 2 uses json-loader by default for all .json files. You should remove the .json rule and you would import the JSON as...
Read more >Tree shaking JSON files with webpack - LogRocket Blog
Webpack performs out-of-the-box tree shaking when compiling multiple JSON files into a single one. Here's how and why you should use it.
Read more >Load a JSON File with ES6 Modules Implementation
In the webpack config file, the loader rule accepts the NPM package to load any of the JSON files in your app. One...
Read more >merge-jsons-webpack-plugin - npm
This plugin is used to merge json files into single json file,using glob or file names. Latest version: 2.0.1, last published: a year...
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
I got this build without errors and it consoles the json correctly, but not sure it’s updating the app right.
Webpack 4 handles JSON natively, but since we have to go through the Dojo loader to process the file, things get tricky.
Let me know if that helps.
Yeah, I don’t know where
type
is doc’d. I just came across it in this issue https://github.com/webpack/webpack/issues/6357Thanks!