Answer the question
In order to leave comments, you need to log in
How to read .json file?
There is a manifest.json file (src/manifest.json) with the following content:
{
"entrypoints": {
"index": {
"assets": {
"js": [
"assets/js/vendors~index~second.js",
"assets/js/index~second.js",
"assets/js/index.js"
],
"css": [
"assets/css/index~second.css",
"assets/css/index.css"
]
}
},
"second": {
"assets": {
"js": [
"assets/js/vendors~index~second.js",
"assets/js/index~second.js",
"assets/js/second.js"
],
"css": [
"assets/css/index~second.css",
"assets/css/second.css"
]
}
}
}
}
const path = require('path')
const { $ } = require('jquery')
const PATHS = {
src: path.join(__dirname, '../src'),
dist: path.join(__dirname, '../dist'),
assets: 'assets/'
}
$.getJSON(PATHS.src + '/manifest.json', function(data) {
console.log(data.entrypoints.index.assets.js)
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question