github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs-website/plugins/custom-loaders/index.js (about) 1 // Create a custom loader to pull in YAML files into the docusaurus webpack build 2 module.exports = function (context, options) { 3 return { 4 name: 'custom-loaders', 5 configureWebpack(config, isServer) { 6 return { 7 module: { 8 rules: [ 9 { 10 // Look for all require("*.yaml,*.toml,*.ini") files 11 test: /\.(yaml|toml|ini)/, 12 // Set this as an asset so it is pulled in as-is without compression 13 type: 'asset/resource', 14 // Generate a filename to place the example next to the generated index.html file 15 // (note this adds a fake "build" directory otherwise the examples get placed one directory too high) 16 // (it also adds a hash since there can be times when the same file is included twice and it needs to be different) 17 generator: { 18 filename: 'build/[file].[hash]' 19 } 20 }, 21 ], 22 }, 23 }; 24 }, 25 }; 26 };