You can add new extensions to require() by extending require.extensions.
For a XML example:
// Add .xml for require()
require.extensions['.xml'] = (module, filename) => {
const fs = require('fs')
const xml2js = require('xml2js')
module.exports = (callback) => {
// ...