1. json-loader
json loader module for webpack
json-loader
Package: json-loader
Created by: webpack
Last modified: Sun, 19 Jun 2022 06:18:03 GMT
Version: 0.5.7
License: MIT
Downloads: 4,286,565
Repository: https://github.com/webpack/json-loader

Install

npm install json-loader
yarn add json-loader

npm
node
deps
tests
coverage
chat

JSON Loader

Install

 npm install --save-dev json-loader

⚠️ Since webpack >= v2.0.0, importing of JSON files will work by default. You might still want to use this if you use a custom file extension. See the v1.0.0 -> v2.0.0 Migration Guide for more information

Usage

Inline

 const json = require('json-loader!./file.json');

Configuration (recommended)

 const json = require('./file.json');

webpack.config.js

 module.exports = {
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: 'json-loader'
      }
    ]
  }
}

Maintainer


Tobias Koppers

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code