I'm attempting to import the contents of a YAML file at build-time, and make the parsed content available to my application somehow.
This is in a Webpack project that I've been tasked with building a new feature for. The project is using Vue. I have pretty much 0 experience with Webpack. I've installed the js-yaml-loader package, and have configured Webpack with it as such:
module: {
rules: [
...,
{
test: /\.ya?ml$/,
include: path.resolve(process.cwd(), 'src/data'),
loader: 'js-yaml-loader'
},
...
]
}
As far as I understand it, this will - at build time - traverse the src/data folder for YAML files, and load them, using the js-yaml-loader loader, which will then somehow include the parsed content of those files somewhere. But when I search the generated output, the keys/values contained in the YAML are nowhere to be found.
Am I going about this correctly? Or is there something I've misunderstood?