Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
XMLWebpackPlugin
✓ const XMLWebpackPlugin = require('xml-webpack-plugin')
✗ import XMLWebpackPlugin from 'xml-webpack-plugin'
Package does not ship ES modules; use CommonJS require.
XMLWebpackPlugin
✓ const XMLWebpackPlugin = require('xml-webpack-plugin'); new XMLWebpackPlugin(options)
✗ new XMLWebpackPlugin()
Constructor requires an options object with a 'files' array.
files array
✓ files: [ { template: 'path/to/template.ejs', filename: 'output.xml' } ]
✗ files: [ 'path/to/template.ejs' ]
Each file entry must be an object, not a string.
Shows basic setup: require the plugin, configure an XML file from an EJS template with custom delimiters.
const path = require('path');
const XMLWebpackPlugin = require('xml-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
plugins: [
new XMLWebpackPlugin({
files: [
{
template: path.join(__dirname, 'template.ejs'),
filename: 'output.xml',
data: { message: 'Hello World' },
}
],
options: {
delimiter: '%',
openDelimiter: '<',
closeDelimiter: '>',
},
}),
],
};
Errors
Common errors & fixes
Error: Cannot find module 'ejs'
ejs is not installed as a dependency
fixnpm install ejs --save-dev
TypeError: files is not iterable
The 'files' property is missing or not an array
fixEnsure the plugin options include: { files: [...] } TypeError: Cannot read property 'readFileSync' of undefined
The template file path does not exist or is not absolute
fixUse an absolute path or ensure the file exists at the given relative path.
Audit
Dependencies
webpackrequiredPeer dependency; requires webpack 4.x or 5.x
ejsrequiredEmbedded JavaScript templating engine used for XML templates