Note: Since webpack v2, JSON files will work by default. You might still want to use this if you use a custom file extension.
npm install --save-dev json-loader
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.json$/,
use: 'json-loader'
}
]
}
}
import json from 'file.json';
webpack --module-bind 'json=json-loader'
import json from 'file.json';
import json from 'json-loader!file.json';
![]() Tobias Koppers |