json loader module for webpack
npm install json-loader[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![chat][chat]][chat-url]
bash
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
$3
`js
const json = require('json-loader!./file.json');
`
$3
`js
const json = require('./file.json');
`
webpack.config.js
`js
module.exports = {
module: {
loaders: [
{
test: /\.json$/,
loader: 'json-loader'
}
]
}
}
``
|
Tobias Koppers |