{"id":20877,"library":"xml-webpack-plugin","title":"XML Webpack Plugin","description":"A webpack plugin (v1.3.0) that generates XML files using EJS templates. Supports Webpack 4.x and 5.x. Key differentiators: it integrates seamlessly into the webpack build pipeline, allows writing XML to the output path or project context path, and uses the popular EJS templating engine. The project is in maintenance mode with no recent updates.","status":"maintenance","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/rvanmil/xml-webpack-plugin","tags":["javascript","webpack","plugin","xml","xml-webpack-plugin"],"install":[{"cmd":"npm install xml-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add xml-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add xml-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; requires webpack 4.x or 5.x","package":"webpack","optional":false},{"reason":"Embedded JavaScript templating engine used for XML templates","package":"ejs","optional":false}],"imports":[{"note":"Package does not ship ES modules; use CommonJS require.","wrong":"import XMLWebpackPlugin from 'xml-webpack-plugin'","symbol":"XMLWebpackPlugin","correct":"const XMLWebpackPlugin = require('xml-webpack-plugin')"},{"note":"Constructor requires an options object with a 'files' array.","wrong":"new XMLWebpackPlugin()","symbol":"XMLWebpackPlugin","correct":"const XMLWebpackPlugin = require('xml-webpack-plugin'); new XMLWebpackPlugin(options)"},{"note":"Each file entry must be an object, not a string.","wrong":"files: [ 'path/to/template.ejs' ]","symbol":"files array","correct":"files: [ { template: 'path/to/template.ejs', filename: 'output.xml' } ]"}],"quickstart":{"code":"const path = require('path');\nconst XMLWebpackPlugin = require('xml-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new XMLWebpackPlugin({\n      files: [\n        {\n          template: path.join(__dirname, 'template.ejs'),\n          filename: 'output.xml',\n          data: { message: 'Hello World' },\n        }\n      ],\n      options: {\n        delimiter: '%',\n        openDelimiter: '<',\n        closeDelimiter: '>',\n      },\n    }),\n  ],\n};","lang":"javascript","description":"Shows basic setup: require the plugin, configure an XML file from an EJS template with custom delimiters."},"warnings":[{"fix":"Consider using html-webpack-plugin with ejs-loader for XML generation.","message":"Package has not been updated in years; may be deprecated for use with newer webpack versions beyond 5.x.","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Always provide at least one file object in the 'files' array.","message":"Plugin requires a 'files' array; passing an empty array or missing 'files' will cause the plugin to silently do nothing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use path.join(__dirname, 'template.ejs') to generate absolute paths.","message":"Template paths must be absolute; relative paths may not resolve correctly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install ejs --save-dev","cause":"ejs is not installed as a dependency","error":"Error: Cannot find module 'ejs'"},{"fix":"Ensure the plugin options include: { files: [...] }","cause":"The 'files' property is missing or not an array","error":"TypeError: files is not iterable"},{"fix":"Use an absolute path or ensure the file exists at the given relative path.","cause":"The template file path does not exist or is not absolute","error":"TypeError: Cannot read property 'readFileSync' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}