1. xml-loader
A webpack module to load XML files.
xml-loader
Package: xml-loader
Created by: gisikw
Last modified: Wed, 29 Jun 2022 05:36:20 GMT
Version: 1.2.1
Downloads: 45,946
Repository: https://github.com/gisikw/xml-loader

Install

npm install xml-loader
yarn add xml-loader

Webpack XML loader

A Webpack plugin for loading XML files.

Installation

Install via npm:

npm install --save xml-loader

Usage

You can require XML data like this:

 var data = require('xml!./data.xml');
// => returns data.xml content as json-parsed object

var data = require('xml?explicitChildren=true!./data.xml');
// => returns data.xml content as json-parsed object and put child elements to separate properties

The loader will translate the data.xml file into a JSON Object. node-xml2js processors are supported via query syntax.

Usage with webpack.config

To require XML files like this: require('data.xml') , you can add the xml-loader to your webpack config:

 module : {
  loaders : [
    { test: /\.xml$/, loader: 'xml-loader' } // will load all .xml files with xml-loader by default
  ]
}

Credits

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code