How to 'require' an xml file (loaded by webpack) in order to read the xml contents in javascript
问题 I'm using webpack as the bundler for a app and using an XML file for it configuration. Currently I'm writing tests to retrieve the config from an XML file packaged by webpack. Referencing this webpack article: Loading data the piece of code I'm having trouble is this: import Data from './data.xml'; I'm my own test, I'm using the require form which is as follows: const select = require('xpath.js'); const DOMParser = require('xmldom').DOMParser const parser = new DOMParser(); const data =