[Vuejs]-Get data from file inside every folder using raw-loader

0๐Ÿ‘

I found another solution, I used require.context:

const getConfig = require.context(
    '../data',
    true,
    /\/[\w-]+\/config\.js$/,
)
getConfig.keys().forEach(fileName => {
    const file = require(`../data${fileName.substring(1)}`).default
    console.log(file)
})

Leave a comment